开发者

how to add 4 image view to flipper in android?

开发者 https://www.devze.com 2022-12-21 05:44 出处:网络
i want to add 4 imageviews to flipper at a time.Please provide some sample code my 开发者_JAVA百科code is

i want to add 4 imageviews to flipper at a time.Please provide some sample code

my 开发者_JAVA百科code is

    final ImageView imageview=new ImageView(this);
    imageview.setBackgroundResource(R.drawable.img1);       

    final ImageView imageview1=new ImageView(this);
    imageview.setBackgroundResource(R.drawable.img2);

    final ImageView imageview2=new ImageView(this);
    imageview.setBackgroundResource(R.drawable.img3);

    final ImageView imageview3=new ImageView(this);
    imageview.setBackgroundResource(R.drawable.img4);

I want to add these images to flipper on by one.


You want each flipper to contain 4 imageviews?
Create a .xml layout with four imageviews, inflate the view, fetch your imageviews by findViewById and set their source-value then add the inflated view to your flipper with

myFlipper.addView(myInflatedView)
0

精彩评论

暂无评论...
验证码 换一张
取 消