禁用Click事件在Android的ListView项目 [英] Disable Click Event on Android ListView Items

查看:203
本文介绍了禁用Click事件在Android的ListView项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图禁用列表视图多个点击事件,之后pressing说,首先单击有些媒体会从web服务发挥,而它被打了,其他的项目需要点击==假的,得到了​​媒体播放后,其他列表项目可以点击。

I'm trying to disable multiple click events on listview, say after pressing first click some media gets played from webservice, while it gets played, other items need to be clickable==false , after media got played,other list items can be clickable.

//我想要呼吁 setClickable(真) setClickable(假)上的ListView对象

// what i'm trying is calling setClickable(true) and setClickable(false) on ListView Object.

推荐答案

请你自己ArrayAdapter有<一个子类href="http://developer.android.com/reference/android/widget/BaseAdapter.html#areAllItemsEnabled%28%29">AreAllItemsEnabled()返回false,并定义<一href="http://developer.android.com/reference/android/widget/BaseAdapter.html#isEnabled">isEnabled(int位置)返回错误在你的那些要禁用一个给定的项目。

Make your own subclass of ArrayAdapter that has AreAllItemsEnabled() return false, and define isEnabled(int position) to return false for a given item in your the ones you want to disable.

这篇关于禁用Click事件在Android的ListView项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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