android - Override theme color* attributes for view or a view hierarchy -
is there way override theme (activity style) property, such colorcontrolactivated, particular view or hierarchy of views?
for example, if have
<item name="colorcontrolactivated">@color/my_activated_color<item>
in activity style, possible override value in widget's style, such toolbar? adding 'colorcontrolactivated' item doesn't seem anything
my current utilize case have switchcompat in app bar toolbar, , global colorcontrolactivated property i've set every widget doesn't on toolbar's background. help me alter specific color every view in toolbar great. , work on both v21 , v15+.
on unrelated note, point me source code of switchcompat, can't seem find in back upwards library's source.
this doesn't reply general question, reply utilize case scenario, might useful other people well.
in order override activity's coloraccent (or other property of theme), had create contextthemewrapper switch, , inflate switch in java, apply wrapper.
the code this:
toolbar toolbar = (toolbar) findviewbyid(r.id.toolbar); setsupportactionbar(toolbar); contextthemewrapper wrapper = new contextthemewrapper( getsupportactionbar().getthemedcontext(), r.style.customtheme); view.inflate(wrapper, r.layout.toolbar_switch, toolbar);
android appcompat material
No comments:
Post a Comment