Skip to content
Advertisement

Add View programmatically and after adding on button click change view background

Add View dynamically in LinearLayout and after adding View change any View background on the click button.

JavaScript

On button, click change all imageview background or particular ImageView.

Note : llLayout is my linear layout this layout adding in XML

Advertisement

Answer

when you are adding imageView into linear layout, at that time you are setImageBitmap to imageView.

if you want to reset Image to Imageview, you should use img1.setImageResource

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement