java - Is there a way I can gray out an ImageButton in Android without maintaining a separate gray copy of the original Image? -
i trying have imagebutton
initially has gray effect on & turns original color when selected. i'm trying achieve . know can done in css, wondering if android attribute / function equivalent existed.
i read post here seems suggest have maintain different gray copy of same image in order achieve this. consume lot of memory maintain 2 copies of same image if have, lets 100+ imagebuttons.
unlike regular button, imagebutton or button has image background not grayed when disabled. have use image or process in way appears grayed.
so there no way achieve in android achieved using grayscale in css?
thank time!!
if using .png
images, use imageview
color filter attribute.
public void setdisabled(imageview imageview) { final colormatrix grayscalematrix = new colormatrix(); grayscalematrix.setsaturation(0); final colormatrixcolorfilter filter = new colormatrixcolorfilter(grayscalematrix); imageview.setcolorfilter(filter); }
Comments
Post a Comment