Android applying theme by version -
i'm developing application starts listview. i'm in trouble setting of themes application. material design can applied android 5.0 , above. created values-21 folder , create styles.xml
follow:
<resources> <!-- inherit light material theme --> <style name="mycustomtheme" parent="android:theme.material.light"> <item name="android:colorprimary">@color/my_lightblue</item> </style> </resources>
in android under 5.0 version theme not applied because not read values-21 folder. have create styles.xml
in values standard folder? mandatory create new theme change te color of app bar (this objective).
i'm bit confused... thank you
from https://developer.android.com/training/material/compatibility.html
you can configure app use material theme on devices support , revert older theme on devices running earlier versions of android:
- define theme inherits older theme (like holo) in res/values/styles.xml.
- define theme same name inherits material theme in res/values-v21/styles.xml.
- set theme app's theme in manifest file.
if layouts design according material design guidelines not use of new xml attributes introduced in android 5.0 (api level 21), work on previous versions of android. otherwise, can provide alternative layouts. can provide alternative layouts customize how app looks on earlier versions of android.
create layout files android 5.0 (api level 21) inside res/layout-v21/
, alternative layout files earlier versions of android inside res/layout/
. example, res/layout/my_activity.xml
alternative layout res/layout-v21/my_activity.xml.
check this answer , blog
Comments
Post a Comment