简体   繁体   English

Android操作栏Sherlock始终在下拉列表中显示操作项

[英]Android Action bar Sherlock show actions items in dropdown always

I have set three action items which am adding to the ABS through menu XML like this: 我已经设置了三个操作项,它们通过菜单XML添加到ABS中,如下所示:

<menu xmlns:android="http://schemas.android.com/apk/res/android" >

    <item
        android:id="@+id/menu_share_app"
        android:icon="@drawable/share_ab"
        android:showAsAction="collapseActionView"
        android:title="@string/menu_share_app"/>
    <item
        android:id="@+id/menu_search"
        android:icon="@drawable/share_ab"
        android:showAsAction="always"
        android:title="@string/menu_search"/>
    <item
        android:id="@+id/menu_settings"
        android:icon="@drawable/share_ab"
        android:showAsAction="collapseActionView"
        android:title="@string/menu_settings"/>

</menu>

I want to show the search item alwys and the other two in a dropdown, I made the showasaction as "collapseActionView" but am not getting any dropdown. 我想在下拉列表中显示搜索项alwys和其他两个,我将showasaction设为“collapseActionView”,但我没有得到任何下拉列表。 Here's the sample pic of what am expecting. 这是我期待的样本图片。 Thanks! 谢谢! :) :) 在此输入图像描述

I just changed the code and order. 我只是改变了代码和顺序。

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
    <item
        android:id="@+id/menu_search"
        android:icon="@drawable/share_ab"
        android:showAsAction="always" 
        android:title="@string/menu_search"/>
    <item
        android:id="@+id/menu_share_app"
        android:icon="@drawable/share_ab"
        android:showAsAction="never"
        android:title="@string/menu_share_app"/>
    <item
        android:id="@+id/menu_settings"
        android:icon="@drawable/share_ab"
        android:showAsAction="never"
        android:title="@string/menu_settings"/>
</menu>

If you are having physical menu button (eg Nexus S) in your device then the dot line will not show. 如果您的设备中有物理菜单按钮(例如Nexus S),则点线将不会显示。 Even if your AVD emulates a device with has physical menu button then same thing will happen. 即使您的AVD模拟具有物理菜单按钮的设备,也会发生同样的事情。 When you press the Menu button it'll show up. 当您按下菜单按钮时,它会显示出来。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM