如何在两列中添加项目在列表视图(安卓)? [英] How to add items in two columns in Listview (Android)?

查看:129
本文介绍了如何在两列中添加项目在列表视图(安卓)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的列表视图工作过,我都存储在arraylist1和arraylist2值,然后从中检索arraylist1,arraylist2的值,然后插入这两个的ArrayLists值 在每一行,怎么样?请任何一个可以帮助我吗?

感谢

例如:

  arraylist1  -  23/1/12
arraylist2  - 欢迎
 

这两个值inser在列表视图

  ListView控件 -  23/1/12欢迎
 

解决方案

您可以使用的多列的ListView在Android中。而在添加你的ArrayList值

 的ArrayList< HashMap的<字符串,字符串>> mylist中=新的ArrayList< HashMap的<字符串,字符串>>();
HashMap的<字符串,字符串>图=新的HashMap<字符串,字符串>();
map.put(值1,arrayList1.get(0));
map.put(值2,arrayList2.get(0));
mylist.add(图)
 

I have worked in Listview, I have stored values in arraylist1 and arraylist2, then retrieve the value from arraylist1, arraylist2 and then insert these two arraylists values in each row, how? Please can any one help me?

Thanks

Example:

arraylist1 - 23/1/12
arraylist2 - welcome

These two values are inser in Listview

ListView - 23/1/12     welcome

解决方案

You can use Multicolumn ListView in Android. And add your arraylists values in

ArrayList<HashMap<String, String>> mylist = new ArrayList<HashMap<String, String>>();
HashMap<String, String> map = new HashMap<String, String>();
map.put("Value1", arrayList1.get(0));
map.put("Value2", arrayList2.get(0));
mylist.add(map);

这篇关于如何在两列中添加项目在列表视图(安卓)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆