2016-08-19 10 views
0

私の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枚の画像、残りは

をprogress.pngている見ることができます

EDIT2:

ここは私のimageView xmlファイルです。

<ImageView 
     android:layout_width="75dp" 
     android:layout_height="75dp" 
     android:id="@+id/imageView_score" /> 
+0

リストをスクロールすると、正しいイメージが表示されますか? –

+0

すべての画像が空です(画像が1枚表示されることもあります)。 – goGud

+0

JSONレスポンスを確認しましたか?また、画像のサイズを確認してください。 –

答えて

0

私はinflater.inflateのパラメータは、Uは[]にすべての画像を追加するためのループを作成する必要があり、その後、uはそれを表示する必要が(R.layout.activity_ident_result2, parent, false)

+0

いいえ、動作しません。 – goGud

-1

べきであると信じています。 Becuさんは、ただ1つの画像を追加して投稿コードを投稿しました。

関連する問題