Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android ImageView的图像资源_Android - Fatal编程技术网

Android ImageView的图像资源

Android ImageView的图像资源,android,Android,在我为我的图库设置了几个图像之后,我想获取所有已使用的资源ID。 如何在库中获取ImageView的图像资源(int) 谢谢 public class IndexImageAdapter extends BaseAdapter { private Context context; private int[] panicBuyingImages = {R.drawable.q1 , R.drawable.q2 , R.drawable.q3 , R.drawable.q4}; publi

在我为我的图库设置了几个图像之后,我想获取所有已使用的资源ID。 如何在库中获取ImageView的图像资源(int)

谢谢

public class IndexImageAdapter extends BaseAdapter {

private Context context;  
private int[] panicBuyingImages = {R.drawable.q1 , R.drawable.q2 , R.drawable.q3 , R.drawable.q4};  
public IndexImageAdapter(Context context){   
    this.context = context;  
}  

public int getCount(){   
    return Integer.MAX_VALUE;  
}  

public Object getItem(int arg0){  
    return arg0;  
}  

public long getItemId(int position){ 
    return position;  
}  

public View getView(int position, View convertView, ViewGroup parent)  {  
    ImageView i = new ImageView(this.context); 
    i.setImageResource(this.panicBuyingImages[position % panicBuyingImages.length]);  
    i.setScaleType(ImageView.ScaleType.FIT_XY);  
    i.setLayoutParams(new Gallery.LayoutParams(140, 140));  
    return i;  
}  

}

首先显示一些关于如何设置图像的代码。您能再解释一下吗