我正在尝试在我的几个图像的代码中设置一个图库,但我遇到的问题是图库只显示我的阵列中的一个图像,第一个图像只有任何人都可以告诉我问题是什么? / p>
由于
代码:
public class ImageAdapter extends BaseAdapter implements SpinnerAdapter {
private Context context;
public ImageAdapter(Context context) {
// TODO Auto-generated constructor stub
this.context = context;
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return ThumbsIds.length;
}
@Override
public Object getItem(int arg0) {
// TODO Auto-generated method stub
return null;
}
@Override
public long getItemId(int arg0) {
// TODO Auto-generated method stub
return 0;
}
@SuppressWarnings("deprecation")
@Override
public View getView(int position, View convertview, ViewGroup arg2) {
// TODO Auto-generated method stub
ImageView imageView = null;
if(convertview==null){
imageView = new ImageView(context);
imageView.setLayoutParams(new Gallery.LayoutParams(250,230));
imageView.setPadding(8,8,8,8);
}else{
imageView =(ImageView)convertview;
}
imageView.setImageResource(ThumbsIds[position]);
return imageView;
}
public Integer[] ThumbsIds ={
R.drawable.seanpic,
R.drawable.billypic,
R.drawable.actor_1
};
}