Android的ListView中自定义行布局 [英] Android ListView custom row layout

查看:320
本文介绍了Android的ListView中自定义行布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要设置在列表视图中的每个项目/行背景颜色和图标图像。 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屋!

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