How To Change The Background Or The Image Source When A Clickable Imageview In Android Is Clicked?
I set android:clickable='true' to an imageview in my android app. I want to change the background or the image source when it is clicked, how could i do that?
Solution 1:
Try this:
myImageView.setOnClickListener(MyOnClickHandler);
And write handler like:
OnClickListenerMyOnClickHandler=newOnClickListener() {
@OverridepublicvoidonClick(View v) {
myImageView.setImageResource(R.id.imageView1);
myImageView.setBackgroundResource(R.id.imageView2);
//myImageView.setImageBitmap(bm);//myImageView.setImageDrawable(R.drawable.image1);
}
};
Post a Comment for "How To Change The Background Or The Image Source When A Clickable Imageview In Android Is Clicked?"