java - How to change the color of intern Android drawables? -
i've tried put intern icons of android (anrdoid.r.drawable.bla) imagebutton , wanted change color of icon (not background!), doesn't work want to.
here i've tried:
my imagebutton layout:
<imagebutton android:id="@+id/imagebutton1" android:layout_margintop="100dp" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/background" android:src="@android:drawable/ic_lock_silent_mode" />
what i've tried in activity:
drawable myicon = getresources().getdrawable( android.r.drawable.ic_lock_silent_mode); colorfilter filter = new lightingcolorfilter( r.color.blue, r.color.blue); myicon.setcolorfilter(filter);
no matter values i've tried lightingcolorfilter gives same result. icon inside imagebutton gets dark. thats not wnated. wanted apply color colors.xml, somehow doesnt work out.
is right direction i'm going? or there opertunity (and don't mean coloring myself in photoshop , putting them drawables folder)
this worked me, example paint in dark gray:
imagebutton imgbtn = (imagebutton) findviewbyid(r.id.imagebutton11); // image button imgbtn.setcolorfilter(getresources().getcolor(android.r.color.darker_gray), mode.src_atop);
Comments
Post a Comment