Sai*_*ail 8 user-interface android android-actionbar

我想在Evernote中制作具有ActionBar的幻灯片菜单.在这个应用程序中,似乎它有2个ActionBars(我不确定).一个在主菜单,另一个在滑动菜单中.
反正有没有像这样构建2个ActionBars?或者它只是一个类似于ActionBar外观的布局排列.
感谢您的帮助,对不起我的英语.
PS.我使用ActionBarSherlock和SlidingMenu来实现这一点,但我找不到像在Evernote中那样做的方法.
你写了:
我用(...)SlidingMenu
如果SlidingMenu您的意思是Jeremy Feinstein的SlidingMenu,并且您想继续使用此菜单库,则不能使用"真实" ActionBar,因为SlidingMenu's菜单是以库中的Fragment名称SlidingMenuFragment实现的.A Fragment不能举行ActionBar.
您可以创建一个看起来像的布局ActionBar.在SlidingMenuFragment's您设置布局文件,如下所示:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup viewGroup = (ViewGroup) inflater.inflate(R.layout.sliding_menu,null);
在菜单的布局文件中,这里称为sliding_menu.xml,您可以通过将其嵌套在顶部的布局中来SearchView看起来像它ActionBar.然后,您将该布局的背景颜色/可绘制设置为与列表其余部分不同的内容.见下面的例子(我知道嵌套LinearLayouts不漂亮...只是使用了一个简单的例子LinearLayout从SlidingMenu示例应用跨越的想法):
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#333333" >
        <SearchView
            android:id="@+id/searchView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />
    </LinearLayout>
    <ListView
        android:id="@android:id/list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingLeft="@dimen/list_padding"
        android:paddingRight="@dimen/list_padding" />
</LinearLayout>
这看起来像:

打开时,右边的浅灰色框是"真实"的一部分ActionBar.
编辑:您在评论中写道:
searchView示例的工作原理我无法让下拉菜单以相同的方式工作.
EverNote应用程序中的下拉菜单看起来像是以Holo为主题实现的Spinner.Android开发人员详细介绍了如何添加Spinner到布局.Spinner的逻辑/ java代码将被放入SlidingMenuFragment(如果您使用SlidingMenu库).
好吧,我在 Gunnar Karlsson 的帮助下成功做到了,他把我推向了正确的方向,而不是 SearchView
我实现了一个 ImageButton 像这样:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
 <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="#333333" >
        <ImageButton
                android:layout_width="wrap_content" 
                android:layout_height="60dp" 
                android:src="@drawable/ic_launcher"
                android:onClick="showPopup" />
</LinearLayout>
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
   android:id="@android:id/list"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   android:paddingLeft="@dimen/list_padding"
   android:paddingRight="@dimen/list_padding" />
</LinearLayout>
在我的 mainActivity 中,我只是从 google 示例代码中提取了此代码来创建弹出菜单:
public void showPopup(View v) {
    PopupMenu popup = new PopupMenu(this, v);
    MenuInflater inflater = popup.getMenuInflater();
    inflater.inflate(R.menu.actions, popup.getMenu());
    popup.show();
}
它奏效了。谢谢古纳尔·卡尔森。