89

Supporting Dark Theme [SUBSCRIBER]

 4 years ago
source link: https://www.tuicool.com/articles/vU32Ybu
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Supporting Dark Theme

Before using a DayNight theme, learn how to use Force Dark as a transition step to supporting Dark Theme on Android 10.

Switch from Force Dark to instead use an AppCompat DayNight theme, so that the themes will work on earlier versions of Android, and then a MaterialComponents DayNight theme.

DayNight themes support a "night" resource qualifier within which you can use styles to customize the views of your app when in Dark theme mode.

Let your user choose to override the system setting and pick either a Light or Dark theme, and then let them follow the system setting so that the app theme switches with the system.

Dive into the smaller details of supporting dark themes and polish your app in both Light and Dark modes.

Dark theme changes at the system level correspond to uiMode configuration changes. See how to let your UI manually handle the change to the system Dark theme setting.

Go back to automatically following the system Dark theme setting, and then adapt your app to follow the Battery Saver setting on versions of Android before Android 10.

Who is this for?

Experienced Android developers eager to learn how to support Dark theme in their apps in both Android 10 as well as earlier versions of Android.

Covered concepts

  • Force Dark
  • DayNight and MaterialComponent themes
  • Following the system theme
  • Night resources
  • Support for pre-Android 10 devices and Battery Saver mode
  • uiMode configuration changes

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK