我可以以某种方式从适配器或扩展活动的类中获取View的子级吗?
ImageView v = (ImageView)parent.getChildAt(position);
v.setImageResource(R.drawable.test2);
我需要在动态下载时更改GridView中的每个ImageView。
我的getView:
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ImageView imageView;
if (convertView == null) {
imageView = new ImageView(mContext);
if (DefinedValues.width/3 < DefinedValues.height/4)
imageView.setLayoutParams(new GridView.LayoutParams
(DefinedValues.height/4, DefinedValues.height/4));
else
imageView.setLayoutParams(new GridView.LayoutParams
(DefinedValues.width/3-5, DefinedValues.width/3-5));
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
imageView.setPadding(8, 8, 8, 8);
} else {
imageView = (ImageView) convertView;
}
imageView.setImageResource(R.drawable.test3);
return imageView;
}