はい、他の質問を見ましたが、そこにある回答は役に立ちませんでした。
アプリが Web からロードする画像を に配置していGridView
ます。getView
とのコードは次のonScrollStateChanged
とおりです。
@Override
public void onScrollStateChanged(AbsListView absListView, int scrollState) {
switch(scrollState) {
case SCROLL_STATE_FLING :
case SCROLL_STATE_TOUCH_SCROLL :
downloader.stopAll();
adapter.removeExecutor(productCategoriesExecutor);
break;
case SCROLL_STATE_IDLE :
loadProductsChunk();
break;
}
}
@Override
public View getView(int i, View view, ViewGroup viewGroup) {
ProductView productView = (ProductView)view;
if(productView == null) {
productView = new ProductView(context, downloader);
productView.setLayoutParams(new GridView.LayoutParams(columnWidth, rowHeight));
}
JSONObject product = getItem(i);
if(product != null) {
try {
Log.i("ololo", String.format("thm: %d ", i) + product.getString("thumbnail"));
productView.setNewPrice(product.getInt("price"));
productView.setOldPrice(product.getInt("oldPrice"));
productView.showThumbnail(product.getString("thumbnail"));
} catch (JSONException e) {
e.printStackTrace();
}
}
else {
productView.setNewPrice(0);
productView.setOldPrice(0);
productView.showThumbnail(null);
}
return productView;
}
そしてありますGridView
:
<GridView
android:id="@+id/productsGrid"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:verticalSpacing="@dimen/products_list_grid_spacing"
android:horizontalSpacing="@dimen/products_list_grid_spacing"
android:stretchMode="columnWidth"
android:scrollingCache="false"
android:alwaysDrawnWithCache="false"
/>
ご覧のとおりProductView
、リンクを受信してからイメージをロード (またはキャッシュから取得) します。リフレッシュはどこでも実行されており、スクロールも現在アクティブではありません。
public void displayRemoteImage(RemoteImage remoteImage) {
if(this.remoteImage != null) {
Log.i("ololo", this.remoteImage.getUrl() + remoteImage.getUrl());
}
if(this.remoteImage == null || !this.remoteImage.getUrl().equals(remoteImage.getUrl())) {
this.remoteImage = remoteImage;
this.remoteImage.setDelegate(this);
}
}
しかし、どこにでもスクロールして戻ると点滅します(その他の写真で)!
よし、大した問題じゃない。
もう1行ロードしましょう
なんてこったい??
そして-はい-どこにでもスクロールして戻ると、必要な写真が表示されます(リロードはありませんでした)。
わかりました、多分私たちは敗者であり、ダウンロードに失敗していますか? さわやかな写真を簡単にオフにしましょう:
ハハ。くそったれ、家に帰ります。
更新ログは次のとおりです。
06-25 17:26:09.759: INFO/ololo(6613): viewId: 0, should show the link: http://mysite//img/products/3/3031/3031thm.jpg
06-25 17:26:09.779: INFO/ololo(6613): original link: http://mysite//img/products/41/41230/41230thm.jpg; should show: http://mysite//img/products/3/3031/3031thm.jpg
06-25 17:26:09.779: INFO/ololo(6613): viewId: 0, should show the link: http://mysite//img/products/3/3031/3031thm.jpg
06-25 17:26:09.859: INFO/ololo(6613): original link: http://mysite//img/products/3/3031/3031thm.jpg; should show: http://mysite//img/products/3/3031/3031thm.jpg
06-25 17:26:09.869: INFO/ololo(6613): viewId: 0, should show the link: http://mysite//img/products/3/3031/3031thm.jpg
06-25 17:26:09.889: INFO/ololo(6613): original link: http://mysite//img/products/3/3031/3031thm.jpg; should show: http://mysite//img/products/3/3031/3031thm.jpg
06-25 17:26:09.889: INFO/ololo(6613): viewId: 0, should show the link: http://mysite//img/products/3/3031/3031thm.jpg
06-25 17:26:09.909: INFO/ololo(6613): original link: http://mysite//img/products/40/40963/40963thm.jpg; should show: http://mysite//img/products/3/3031/3031thm.jpg
06-25 17:26:09.919: INFO/ololo(6613): viewId: 1, should show the link: http://mysite//img/products/40/40748/40748thm.jpg
06-25 17:26:09.939: INFO/ololo(6613): original link: http://mysite//img/products/40/40940/40940thm.jpg; should show: http://mysite//img/products/40/40748/40748thm.jpg
06-25 17:26:09.939: INFO/ololo(6613): viewId: 2, should show the link: http://mysite//img/products/40/40771/40771thm.jpg
06-25 17:26:09.999: INFO/ololo(6613): original link: http://mysite//img/products/40/40934/40934thm.jpg; should show: http://mysite//img/products/40/40771/40771thm.jpg
06-25 17:26:09.999: INFO/ololo(6613): viewId: 3, should show the link: http://mysite//img/products/40/40790/40790thm.jpg
06-25 17:26:10.009: INFO/ololo(6613): original link: http://mysite//img/products/40/40914/40914thm.jpg; should show: http://mysite//img/products/40/40790/40790thm.jpg
06-25 17:26:10.009: INFO/ololo(6613): viewId: 4, should show the link: http://mysite//img/products/40/40913/40913thm.jpg
06-25 17:26:10.029: INFO/ololo(6613): original link: http://mysite//img/products/40/40913/40913thm.jpg; should show: http://mysite//img/products/40/40913/40913thm.jpg
06-25 17:26:10.029: INFO/ololo(6613): viewId: 5, should show the link: http://mysite//img/products/40/40914/40914thm.jpg
06-25 17:26:10.049: INFO/ololo(6613): original link: http://mysite//img/products/40/40790/40790thm.jpg; should show: http://mysite//img/products/40/40914/40914thm.jpg
06-25 17:26:10.049: INFO/ololo(6613): viewId: 6, should show the link: http://mysite//img/products/40/40934/40934thm.jpg
06-25 17:26:10.069: INFO/ololo(6613): original link: http://mysite//img/products/40/40771/40771thm.jpg; should show: http://mysite//img/products/40/40934/40934thm.jpg
06-25 17:26:10.069: INFO/ololo(6613): viewId: 7, should show the link: http://mysite//img/products/40/40940/40940thm.jpg
06-25 17:26:10.089: INFO/ololo(6613): original link: http://mysite//img/products/40/40748/40748thm.jpg; should show: http://mysite//img/products/40/40940/40940thm.jpg
06-25 17:26:10.099: INFO/ololo(6613): viewId: 8, should show the link: http://mysite//img/products/40/40963/40963thm.jpg
06-25 17:26:10.159: INFO/ololo(6613): original link: http://mysite//img/products/3/3031/3031thm.jpg; should show: http://mysite//img/products/40/40963/40963thm.jpg
06-25 17:26:10.330: INFO/ololo(6613): viewId: 0, should show the link: http://mysite//img/products/3/3031/3031thm.jpg
06-25 17:26:10.340: INFO/ololo(6613): original link: http://mysite//img/products/3/3031/3031thm.jpg; should show: http://mysite//img/products/3/3031/3031thm.jpg
06-25 17:26:10.340: INFO/ololo(6613): viewId: 0, should show the link: http://mysite//img/products/3/3031/3031thm.jpg
06-25 17:26:10.390: INFO/ololo(6613): original link: http://mysite//img/products/3/3031/3031thm.jpg; should show: http://mysite//img/products/3/3031/3031thm.jpg
06-25 17:26:10.390: INFO/ololo(6613): viewId: 0, should show the link: http://mysite//img/products/3/3031/3031thm.jpg
06-25 17:26:10.410: INFO/ololo(6613): original link: http://mysite//img/products/3/3031/3031thm.jpg; should show: http://mysite//img/products/3/3031/3031thm.jpg
アップデート
これは、HTC Explorer (2.3.3) および HTC Nexus One (2.3.6) で発生していますが、Samsung Galaxy Tab 10.1 (3.2) では発生していません。