在 ListView 中创建类别? [英] Creating categories in a ListView?

查看:22
本文介绍了在 ListView 中创建类别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在像 Preferences (PreferenceCategory) 中的那些任意 ListView 中创建类别?

我发现 android.R.layout.preference_category 呈现灰色的 TextView,但在 java 代码的任何地方都没有看到它.

解决方案

<块引用>

如何在任意 ListView 中创建类别,例如首选项(PreferenceCategory)?我找到了 android.R.layout.preference_category呈现灰色TextView 但在 java 代码的任何地方都没有看到它.

http://jsharkey.org/blog/2008/08/18/separating-lists-with-headers-in-android-09/

注意代码来自Android 0.9并且可能需要对在 Android 1.5 中工作.

我有一个兼容 Android 1.5 的他的代码的变体:

http://commonsware.com/AdvAndroid/

(向下滚动,点击源代码链接,然后查看ListView/Sections 项目)

-- Mark Murphy(Commons Guy)http://commonsware.com忙碌的程序员 Android 开发指南 2.0 版可用!

谢谢,马克!

How do I create categories in an arbitrary ListView like those in Preferences (PreferenceCategory)?

I've found android.R.layout.preference_category that renders that grey TextView but don't see it mentioned anywhere from java code.

解决方案

How do I create categories in an arbitrary ListView like those in Preferences (PreferenceCategory)? I've found android.R.layout.preference_category that renders that grey TextView but don't see it mentioned anywhere from java code.

http://jsharkey.org/blog/2008/08/18/separating-lists-with-headers-in-android-09/

Note that the code is from Android 0.9 and may require minor modifications to work in Android 1.5.

I have an Android 1.5-compatible variant on his code up at:

http://commonsware.com/AdvAndroid/

(scroll down, click on the Source Code link, and look at the ListView/Sections project)

-- Mark Murphy (a Commons Guy) http://commonsware.com The Busy Coder's Guide to Android Development Version 2.0 Available!

Thanks, Mark!

这篇关于在 ListView 中创建类别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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