【发布时间】:2014-01-14 17:15:26
【问题描述】:
我按照本教程实现了一个网格视图:
http://developer.android.com/guide/topics/ui/layout/gridview.html
适配器参考了以下图片:
// references to our images
private Integer[] mThumbIds = {
R.drawable.sample_2, R.drawable.sample_3,
R.drawable.sample_4, R.drawable.sample_5,
R.drawable.sample_6, R.drawable.sample_7,
R.drawable.sample_0, R.drawable.sample_1,
R.drawable.sample_2, R.drawable.sample_3,
R.drawable.sample_4, R.drawable.sample_5,
R.drawable.sample_6, R.drawable.sample_7,
R.drawable.sample_0, R.drawable.sample_1,
R.drawable.sample_2, R.drawable.sample_3,
R.drawable.sample_4, R.drawable.sample_5,
R.drawable.sample_6, R.drawable.sample_7
};
然后使用setImageResource显示图片:
imageView.setImageResource(mThumbIds[position]);
我想改进它并且...:
- 从网上下载图片(我会提供URI)
- 缓存图片
- 在 GridView 中显示它们
我该怎么做?请指出正确的方向并尽可能提供任何相关教程
【问题讨论】:
-
编写自己的逻辑以通过网络获取数据或使用库通用图像加载器或 volley
-
我更喜欢自己编写 fetcher。你知道这方面有什么好的教程吗?
标签: android gridview android-gridview android-gridlayout