Changing Themes
As well as dimming the screen, you can use a different theme that reverses the black text to white text on black, which can be easier on the eye in dim light.
Depending on which version of Android the application is running, it may be using a different theme. On Android API level 14 and later, it’s using Theme.Halo.Light.DarkActionBar;
on API level 11 and later, it’s using Theme.Halo.Light;
and under API level 11, it’s using Theme.Light
. This is defined in the values/style.xml
files you have already looked at. Each of these themes has a corresponding reversed (or dark) theme.
For a theme to be applied, it must be set before the view is inflated. This means that it must come before the call to setContentView
. You must restart your ...
Get Learning Android™ Application Programming: A Hands-On Guide to Building Android Applications now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.