android - ReplaceAll the ImageView in FrameLayout -


there framelayout , button,i want add 6 imageview onto framelayout,and replaceall 6 imageview other 6 imageview when click button.thus framelayout may display 12 imageview together.(i use universal_imageloader load image imageview).how resolve problem?

you can set images programmatically (not in xml),you dont need have 12 image views.

for example set on click listener button,so when click it, set new image imageview:

image1 = (imageview) findviewbyid(r.id.imageview1); image2 = (imageview) findviewbyid(r.id.imageview2); image3 = (imageview) findviewbyid(r.id.imageview3); image4 = (imageview) findviewbyid(r.id.imageview4); image5 = (imageview) findviewbyid(r.id.imageview5); image6 = (imageview) findviewbyid(r.id.imageview6); final button button = (button) findviewbyid(r.id.button_id);          button.setonclicklistener(new view.onclicklistener() {              public void onclick(view v) {                  image1.setimageresource(r.drawable.mypic1);                  image2.setimageresource(r.drawable.mypic2);                  image3.setimageresource(r.drawable.mypic3);                  image4.setimageresource(r.drawable.mypic4);                  image5.setimageresource(r.drawable.mypic5);                  image6.setimageresource(r.drawable.mypic6);              }          }); 

the setimageresource method sets new picture on imageview given (the imageviews here image1, image2, image3, image4, image5, image6 ).

now have put method inside onclick whenever click button 6 of images change image chose (in example images chose mypic1, mypic2, mypic3, mypic4, mypic5, mypic6 )

this way have replaced 6 imageviews other 6 imageviews click of button wanted

i hope helps :)


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -