how to change the background or the image source when a clickable imageview in android is clicked? -
i set android:clickable="true" imageview in android app. want change background or image source when clicked, how that?
try this:
myimageview.setonclicklistener(myonclickhandler);
and write handler like:
onclicklistener myonclickhandler = new onclicklistener() { @override public void onclick(view v) { myimageview.setimageresource(r.id.imageview1); myimageview.setbackgroundresource(r.id.imageview2); //myimageview.setimagebitmap(bm); //myimageview.setimagedrawable(r.drawable.image1); } };
Comments
Post a Comment