-
Notifications
You must be signed in to change notification settings - Fork 0
Controlling what users view when users switch modes
Devrath edited this page May 28, 2021
·
1 revision
- We can achieve this using the styles having two values folder for
normal mode
anddark mode
res/values/styles.xml
res/values-night/styles.xml
- To create
values-night
folder- Right-click on the values folder
- Select
new
from the options. - In the available qualifiers select
Night-Mode
and push to right using the middle selection arrows. - Then Select
Not Night
mode - Give the file name as
styles
- Press
ok
- In the
res/values/styles.xml
add the below entries
<style name="TextStyle" parent="AppTheme">
<item name="android:text">@string/let_me_out</item>
</style>
<style name="ImageStyle" parent="AppTheme">
<item name="android:src">@drawable/airlock</item>
</style>
- In the
res/values-night/styles.xml
add the below entries
<style name="TextStyle" parent="AppTheme">
<item name="android:text">@string/let_me_out</item>
</style>
<style name="ImageStyle" parent="AppTheme">
<item name="android:src">@drawable/astronaut</item>
</style>