How To Set Coloraccent In Code?
I want to change my application's theme in code , so i google it ... Unfortunately, i can't find any method to ** set colorAccent in java code . **I don't want to set this attrib
Solution 1:
You can not do this via code.
You can set a default theme with this attribute.
In the activity where you want to change the color, simply create another theme that inherits the default theme, but this new theme you put another color for coloAccent
Default Theme:
<item name="colorPrimary">@color/default_color_app</item>
<item name="colorPrimaryDark">@color/default_color_app_dark</item>
<item name="colorAccent">@color/default_color_app_dark</item>
Another Activity:
<stylename="BaseTheme.AnotherActivity"parent="BaseTheme"><itemname="colorAccent">@color/another_color</item></style>
Post a Comment for "How To Set Coloraccent In Code?"