如何填充衬垫布局内相同的布局(Android版) [英] How to populate the same layout inside a liner layout (Android)
问题描述
我需要创建一个列表。该列表将包含类似的对象。每个对象都会有一些图片,文字和按钮。我可以把这些项目表中的布局和安排他们(孩子)。但我需要有这些(童车)项的列表。我需要通过动态来填充他们。所以,我只是不能code他们在一开始的XML。
I need to create a list. The list will contain similar objects. each object will have some images, text and buttons. I can put those items in a table layout and arrange them (child). But i need to have a list of these(childs) items. And i need to populate them by dynamically. So i just cant code them in an XML at the beginning.
我怎么能做到这一点。您可以张贴一些教程或样品。
How can i do it. Can you post some tutorials or samples.
感谢您
推荐答案
这帮助了我很多在设计自定义视图作为列表视图的一部分 -
This helped me a lot in designing custom views as part of a listview -
http://saigeethamn.blogspot.in/2010/ 04 /自定义列表视图,Android的developer.html
编辑 -
从来没有试过可能在哪里,这是 -
never tried may be where this is -
new String[] {"pen","price","contactid"},
new int[] {R.id.text1,R.id.text2}
在xml文件imageviews替换文本
replace text by imageviews in xml file
和又在哪里,这是
HashMap<String,String> tempnew = new HashMap<String,String>();
temp.put("pen",cur.getString(1).replace("+", " "));
与repalce它
repalce it with
HashMap<String,Image> tempnew = new HashMap<String,Image>();
temp.put("pen",Image1);
将Image1的是你的图片
Image1 will be your image
这是你的意思?
这篇关于如何填充衬垫布局内相同的布局(Android版)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!