[英]Detect if action bar item is in overflow menu or actually displayed on action bar?
This is one of my items of actionbar - 这是我的操作栏之一-
<item
android:id="@+id/mode"
android:icon="@drawable/ic_action_ring_volume"
android:showAsAction="ifRoom"
android:title="@string/Ringing_Mode"/>
Here i am using ifRoom in showAsAction . 在这里,我在showAsAction中使用ifRoom。 Now it may or may not show on action bar according to the space available.
现在,根据可用空间,它可能会或可能不会显示在操作栏上。 How can i detect if it's showing in overflow menu or its actually displayed on action bar ?
我如何检测它是显示在溢出菜单中还是实际显示在操作栏上? (I am not using ActionBarSherlock)
(我没有使用ActionBarSherlock)
If you are using ActionBarSherlock you can look for the boolean value abs__split_action_bar_is_narrow
如果您使用的是ActionBarSherlock ,则可以查找布尔值
abs__split_action_bar_is_narrow
Create static method where you can do 创建可以做的静态方法
return ResourcesCompat.getResources_getBoolean(context,
R.bool.abs__split_action_bar_is_narrow);
you need to use the ResourcesCompat (from actionbarsherlock) class. 您需要使用ResourcesCompat(来自actionbarsherlock)类。
This will Provide you,if it's showing in overflow menu or its actually displayed on action bar. 如果它显示在溢出菜单中或它实际显示在操作栏上,则将为您提供。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.