2013-07-11 38 views
0

如何将imageview的数组传递到下面的代码PASS ImageView的阵列为位图的Android

图像视图阵列

private Integer[] Imgid = { 
      R.drawable.pic1, 
      R.drawable.pic2, 
      R.drawable.pic3, 
      R.drawable.pic4, 
    }; 

    Bitmap bitmapOrg = BitmapFactory.decodeResource(getResources(),**R.drawable.pic1[]???**); 
+0

那么究竟ü想干什么? – dhams

回答

0

你必须创建一个Bitmap数组,你运行一个循环把drawable到这样的位图:

private Integer[] Imgid = { 
      R.drawable.pic1, 
      R.drawable.pic2, 
      R.drawable.pic3, 
      R.drawable.pic4, 
    }; 
    Bitmap bitmapOrg[]; 
    for (int i = 0; i < Imgid.length; i++) {   
     bitmapOrg[i] = BitmapFactory.decodeResource(getResources(),Imgid[i]); 
    } 
0

呼叫像正常阵列。

Bitmap bitmapOrg = BitmapFactory.decodeResource(getResources(),imgid[index]);