私のListAdapterの画像ビューに画像を読み込もうとしています。しかし、私は10のサムネイルイメージをlistAdapterに渡してイメージビューでそれらを設定していますが、imageviewでは1またはnoneのみが表示されます。私がドキュメントから理解しているように、picassoライブラリは既にasyntaskを操作しているので、asyntaskを使う必要はありません。私はこの問題をどのように処理できるのか教えてください。Android Picassoが画像ビューにすべての画像を読み込まない
//このようなCustumListAdapterを呼び出します。
CustomListAdapter customListAdapter = new CustomListAdapter(this, resultArrayList);
listView = (ListView) findViewById(R.id.listview_score);
listView.setAdapter(customListAdapter)
//そして、ここに私のCustomListAdapterクラスは、EDIT
public class CustomListAdapter extends ArrayAdapter<String> {
private ArrayList<String> resultContent;
//private Integer[] imageid;
private Activity context;
public CustomListAdapter(Activity context, ArrayList<String> resultContent) {
super(context, R.layout.activity_ident_result2, resultContent);
this.context = context;
this.resultContent = resultContent;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = context.getLayoutInflater();
View listViewItem = inflater.inflate(R.layout.activity_ident_result2, null, true);
if (position % 2 == 0) {
TextView textViewName = (TextView) listViewItem.findViewById(R.id.textView_score);
textViewName.setText(resultContent.get(position));
ImageView imageView = (ImageView) listViewItem.findViewById(R.id.imageView_score);
//imageView.setImageBitmap(IdentResultActivity.splittedBitmaps.get(position + 1));
Picasso.with(this.context).load(resultContent.get(position + 1)).into(imageView);
}
return listViewItem;
}
}
です:
私は.placeholder(R.drawble.progress)
を使用し、私は問題なく配置された1枚の画像、残りは
EDIT2:
ここは私のimageView xmlファイルです。
<ImageView
android:layout_width="75dp"
android:layout_height="75dp"
android:id="@+id/imageView_score" />
リストをスクロールすると、正しいイメージが表示されますか? –
すべての画像が空です(画像が1枚表示されることもあります)。 – goGud
JSONレスポンスを確認しましたか?また、画像のサイズを確認してください。 –