【发布时间】:2012-05-28 06:10:06
【问题描述】:
我有一个网格视图适配器,所有内容都在这段代码中:
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
View v = convertView;
CheckBox check = null;
ImageView pic = null;
if (convertView == null) { // if it's not recycled, initialize some
// attributes
LayoutInflater vi = (LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(R.layout.check_box_and_imageview, null);
}
pic = (ImageView)v.findViewById(R.id.imageView);
check = (CheckBox) v.findViewById(R.id.checkBox);
check.setTag(position);
ImageLoader loader = new ImageLoader(mContext);
//this loads image from given url
loader.DisplayImage(url[position], pic);
return v;
}
在这里,我创建了一个带有复选框和图像视图的视图。存在问题,因为图像视图的大小不同,并且 gridview 通过大小复选框和图像视图进行对齐。但我想通过复选框订购元素。
为了更好地解释我想要做的将显示这张图片:
这是我想做的。我的图像视图大小不一样。现在我将说明它的外观:
所以这不适合我。我想对齐不是所有的复选框和图像视图。但只是复选框将位于复选框下方。
所以这不可能与网格视图有关吗?
【问题讨论】:
-
使用 60x60 等加载器图像的尺寸,并使用 loader.setScaleType(ScaleType.FIT_XY) 等缩放类型;
-
我们不能将所有网格元素左对齐,这样复选框就会在复选框下方......