可以在动作条下拉导航列表控制被禁用? [英] Can the ActionBar drop-down navigation list control be disabled?

查看:149
本文介绍了可以在动作条下拉导航列表控制被禁用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用ActionBar的导航控制提供一个下拉列表。我想禁用下拉在某些情况下列表中选择。

I'm using a navigation control in the ActionBar to provide a drop-down list. I would like to disable selection of the drop down list under certain circumstances.

我对微调适配器的封闭视图布局有一个的TextView 包裹在一个的LinearLayout 。我想出了被覆盖 getView 在我的飞旋的适配器,使得无论是的LinearLayout 和<$ C最好$ C>的TextView 不可点击的禁用。这具有变灰文本的效果,但它仍可以选择

My layout for the closed view of the spinner adapter has a TextView wrapped in a LinearLayout. The best I've come up with is overriding getView in my spinner's adapter and making both the LinearLayout and TextView non-clickable and disabled. This has the effect of greying out the text but it can still be selected.

修改我AP preciate我可以隐藏列表,但是这不是我想做的事情。此外,我已经在检查一个或所有项目启用的方法返回false,但不起作用。

Edit I appreciate that I can hide the list but this is not what I want to do. Furthermore I have returned false in the methods which check if one or all items are enabled but this does not work.

试图让这个工作有一个Xoom的蜂窝。提前致谢。彼得。

Trying to get this working with Honeycomb on a Xoom. Thanks in advance. Peter.

推荐答案

如果您想在列表导航模式什么prevent选择,呼叫 setNavigationMode(NAVIGATION_MODE_STANDARD)和摆脱它完全,直到你准备好了可以再次使用。

If you want to prevent selection of anything in the list navigation mode, call setNavigationMode(NAVIGATION_MODE_STANDARD) and get rid of it entirely until you are ready for it to be used again.

如果您想在列表导航模式下的具体项目的prevent选择,有你的 SpinnerAdapter 实施 areAllItemsEnabled()返回和实施 isItemEnabled()返回真正需要 - 我没有尝试这样做,但在理论上它应该工作

If you want to prevent selection of specific items in the list navigation mode, have your SpinnerAdapter implement areAllItemsEnabled() to return false and implement isItemEnabled() to return true or false as needed -- I haven't tried this, but in theory it should work.

这篇关于可以在动作条下拉导航列表控制被禁用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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