0
我正在從服務獲取圖像路徑,並且正在從服務中下載並在圖像視圖中顯示。我的問題是如果我向下滾動或向上圖像正在重新加載並更改那裏的位置。如果向上或向下滾動,我的圖像會重新下載並更改位置
public View getView(final int position, View convertView, ViewGroup parent) {
Log.d("getview:", "position=" + position);
View vi = convertView;
final ViewHolder holder;
if (convertView == null) {
vi = inflater.inflate(R.layout.my_asset_list_item, null);
// vi = inflater.inflate(R.layout.my_asset_list_item, parent,
// false);
holder = new ViewHolder();
holder.tvGroupTitle = (TextView) vi.findViewById(R.id.tvGroupTitle);
holder.tvGroupDescription = (TextView) vi
.findViewById(R.id.tvGroupDescription);
holder.imgscrollchild = (LinearLayout) vi
.findViewById(R.id.imgscrollchild);
vi.setTag(holder);
} else {
holder = (ViewHolder) vi.getTag();
}
if (data.size() <= 0) {
vi.setVisibility(View.GONE);
} else {
tempValues = null;
tempValues = (GroupsModel) data.get(position);
for (int k = 0; k < data.size(); k++) {
}
holder.tvGroupTitle.setText(tempValues.getName().toString());
holder.tvGroupDescription.setText(tempValues.getDescription().toString());
holder.imgscrollchild.removeAllViews();
if (tempValues.getItemmodel().size() == 0) {
return vi;
} else {
for (int i = 0; i < tempValues.getItemmodel().size(); i++) {
a = i;
Log.i("Index", String.valueOf(i));
holder.imgscrollchild.addView(createimg(tempValues.getItemmodel(), a));
Log.i("Index A", String.valueOf(a));
}
}
}
return vi;
}