android - Can i change accent color (AppCompat) programmatically? -
i have:
<style name="apptheme" parent="theme.appcompat"> <item name="coloraccent">@color/mycolor</item> </style> but want allow user change accent color. can appcompat?
no can't, because accent color defined in theme , themes read-only in android.
the thing can switch themes or set color of each component manually.
note: can apply theme portion of ui instead of whole activity in order change accent color (or other things) locally. so, can use android:theme attribute in xml layout appcompat library, or can inflate layout providing contextthemewrapper context layoutinflater.
Comments
Post a Comment