0
我有一個包含幾個listviews的應用程序。列表視圖包含由圖像視圖和文字視圖組成的項目。Android ListView在通過互聯網加載時混合圖像
所有圖像是用於加載它們的服務器和圖案上的縮略圖尺寸是這樣的:
- 實例化一個DrawableManager
- 在getView方法i執行以下 1)通拇指URI和ImageView實例到drawablemanagers getImageAsync方法 1.2)如果圖像存在,該方法將首先在SD卡上查看,如果從SD卡加載並保存softreference +更新imageview可繪製 1.2)如果sd上不存在。從HTTP獲取並保存在SD(如果有足夠的空間)作爲softreference並更新imageview可繪製。
當SD卡上的圖像存在時,一切正常。但是第一次(或者在沒有SD卡的情況下使用該應用程序時)圖像似乎會在滾動時填充到錯誤的列表視圖行中。當我停止滾動問題修復後幾秒鐘自我。
它幾乎就像是如果ImageView引用匯集或什麼的。
任何想法?
我還包括getView方法:
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder vh;
if (convertView == null) {
convertView = inflater.inflate(R.layout.informationrow, null);
vh = new ViewHolder();
vh.imageView = (ImageView) convertView.findViewById(R.id.rowInformationIcon);
vh.textView = (TextView) convertView.findViewById(R.id.rowInformationTitleLine);
convertView.setTag(vh);
}
else
{
vh = (ViewHolder) convertView.getTag();
}
CustomCategory cc = items.get(position);
if (cc != null) {
vh.textView.setText(cc.get_name());
if (cc.getMediaUrl() != null) {
_drawMgr.fetchDrawableOnThread(cc.getMediaUrl(), vh.imageView);
vh.imageView.setBackgroundDrawable(getResources().getDrawable(R.drawable.imageframe));
}
else {
vh.imageView.setImageDrawable(getResources().getDrawable(R.drawable.trans4040));
vh.imageView.setBackgroundDrawable(null);
}
}
return convertView;
}
謝謝!