如何在Android的列表视图中禁用特定的列表项? [英] How to disable the particular list item in list-view in android?

查看:87
本文介绍了如何在Android的列表视图中禁用特定的列表项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在android的列表视图中禁用特定的列表项? 我的意思是,如果我从列表视图中选择了一项,则该项目应该被禁用,这意味着该项目不应再次被选择. 该怎么做?

How to disable the particular list item in list-view in android? I mean if once i selected any one of item from a list-view,that item suppose to be disabled which means that item should not be select-able again. How to do this?

请提出建议

感谢您的宝贵时间!..

Thanks for your precious time!..

推荐答案

尝试在setOnItemClicklistener()中使用此代码

try using this code in setOnItemClicklistener()

if(listview.getChildAt(selectedPosition).isEnabled())
{
    listview.getChildAt(selectedPosition).setEnabled(false);
}

这篇关于如何在Android的列表视图中禁用特定的列表项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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