Android: how to change dynamically the button icon color? -
i have button in layout:
<button android:id="@+id/followers_right" android:drawableleft="@drawable/ic_team" android:text="@string/visibility_right_followers" />
by default, icons grey. in cases, want apply specific color. , drawable button, how can programmatically ?
mybutton.setcolorfilter(getresources().getcolor(r.color.tint_selected));
this line doesn't work (build error).
thanks help!
i tried find solution myself interesting question not there yet. 1 work around have same icon in different colors drawable
resources,
and change icon of button grammatically,
yourbuttom.setcompounddrawableswithintrinsicbounds(r.drawable.low, 0, 0, 0);
but issue is, if want huge range of color chages
Comments
Post a Comment