Android的ListView中自定义行布局 [英] Android ListView custom row layout
问题描述
我需要设置在列表视图中的每个项目/行背景颜色和图标图像。 ArrayAdapter创下了单布局要添加到列表中的所有项目,我试图抓住每一个项目getChildAt(),但它失败!
I need to set a background color and icon image for each item/row in the list view. ArrayAdapter set a single layout to all the items to be added to the list and I tried to catch every item getChildAt() but it fails !!
简单地说,我需要建立这样一个ListView:
simply, I need to build a listview like that :
顺便说一句,这将在导航抽屉内使用,如下所示:
BTW, It will be used inside the navigation drawer, as shown :
推荐答案
您需要使用BaseAdapter这个任务,检查链接的打击,以及自定义的例子根据您的需要。
You need to use "BaseAdapter" for this task, check the link blow, and customize the example according to your need.
的http://www.androidhive.info/2012/02/android-custom-listview-with-image-and-text/
您还可以检查此
http://www.vogella.com/articles/AndroidListView/article.html
这篇关于Android的ListView中自定义行布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!