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

Popular posts from this blog

java - HTTP Status 500 - An exception occurred processing JSP page /second.jsp at line 15 -

php - Using str_replace to translate a MySQL Table in html -

asp.net mvc - Cannot display error message on Editor or EditorFor -