我引用并使用Etsy StaggeredGridView将来自json的数据从AsyncTask加载到GridView中的路径:http://www.technotalkative.com/lazy-productive-android-developer-part-6-staggered-gridview/
1。在StaggeredGridActivity类中,我尝试更改数据类型:
从:
private ArrayList<String> mData;
到
private ArrayList<HashMap<String, String>> mData;
2。在SampleAdapter类中,我尝试更改:
从:
public class StaggeredAdapter extends ArrayAdapter<String> {
...
public StaggeredAdapter(Context context, int textViewResourceId,
ArrayList<String> objects) {
super(context, textViewResourceId, objects);
...
}
...
}
到
public class StaggeredAdapter extends ArrayAdapter<HashMap<String,String>> {
...
public StaggeredAdapter(Context context, int textViewResourceId,
ArrayList<HashMap<String,String>> objects) {
super(context, textViewResourceId, objects);
...
}
...
}
然后,似乎StaggeredAdapter类中有一个例外:
ImageLoader.getInstance().displayImage(getItem(position), vh.imgView);
带警报的:
Cannot resolve method 'displayImage(java.util.HashMap<java.lang.String,java.lang.String>,com.etsy.android.grid.util.DynamicHeightImageView)'
如何修复和更改ArrayList的数据类型为HashMap
谢谢!