如何禁用子项的列表视图(使其颜色灰色,无法点击) [英] How to disable a child item in a listview(make its color gray and unclickable)

查看:170
本文介绍了如何禁用子项的列表视图(使其颜色灰色,无法点击)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序,有一个列表视图,并点击它的每个项目导致的操作。

in my application, there is a listview, and clicking each item of it leads to an operation.

,但在某些情况下,一些操作不能进行。

but in some situation, some operation can not be done.

如何在列表视图禁用子项(使其颜色灰色,无法点击)?

how to disable a child item in a listview (make its color gray and unclickable)?

推荐答案

您应该重写<一个href="http://developer.android.com/reference/android/widget/ListAdapter.html#isEnabled%28int%29">isEnabled在您的适配器。只要跟踪要禁用,并返回他们的正确值的项目。

You should override isEnabled in your adapter. Just keep track of the items you want to disable and return the correct value for them.

这篇关于如何禁用子项的列表视图(使其颜色灰色,无法点击)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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