【发布时间】:2013-11-13 23:50:16
【问题描述】:
我遇到了这个问题:我正在使用操作栏导航抽屉,但我想在菜单栏中另外添加一个按钮,比如这些按钮: http://screenshots.en.sftcdn.net/blog/en/2013/06/notifications-b.png
这是我的 xml 文件:
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- The navigation drawer -->
<ListView
android:id="@+id/left_drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#111"
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:dividerHeight="0dp" />
</android.support.v4.widget.DrawerLayout>
所以,我知道添加按钮是这样的:
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:yourapp="http://schemas.android.com/apk/res-auto" >
<!-- Search, should appear as action button -->
<item android:id="@+id/action_search"
android:icon="@drawable/ic_action_search"
android:title="@string/action_search"
yourapp:showAsAction="ifRoom" />
</menu>
但我仍然不知道如何安装这两个部分,有人可以帮助我吗?
【问题讨论】:
标签: android button android-actionbar drawer