我有一个可以容纳图像的ListView。这取决于SDCARD中是否存在图像。这是我的示例代码:public class MainActivity extends Activity { ListView mListView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mListView = new ListView(this); setContentView(mListView); String[] arr = new String[] { "/example/images/1.jpg", "/example/images/2.jpg", "/example/images/3.jpg", "/example/images/4.jpg", "/example/images/5.jpg", "/example/images/6.jpg", "/example/images/7.jpg", "/example/images/8.jpg", "/example/images/9.jpg", "/example/images/1.jpg", "/example/images/2.jpg", "/example/images/3.jpg", "/example/images/4.jpg", "/example/images/5.jpg", "/example/images/6.jpg", "/example/images/7.jpg", "/example/images/8.jpg", "/example/images/9.jpg", "/example/images/1.jpg", "/example/images/2.jpg", "/example/images/3.jpg", "/example/images/4.jpg", "/example/images/5.jpg", "/example/images/6.jpg", "/example/images/7.jpg", "/example/images/8.jpg", "/example/images/9.jpg", "/example/images/1.jpg", "/example/images/2.jpg", "/example/images/3.jpg", "/example/images/4.jpg", "/example/images/5.jpg", "/example/images/6.jpg", "/example/images/7.jpg", "/example/images/8.jpg", "/example/images/9.jpg"}; List<String> list = Arrays.asList(arr); MyAdapter adapter = new MyAdapter(this, R.layout.listitem_imv, list); mListView.setAdapter(adapter); }
- 3 回答
- 0 关注
- 487 浏览
添加回答
举报
0/150
提交
取消