我正在使用android設計支持庫,我想知道如何擁有右側導航抽屜的權利,我將重力設置爲正確但只有導航抽屜本身移動到正確的位置,我想知道如何將菜單項放在右側? 導航視圖:從右到左的導航抽屜菜單使用android設計支持庫
<android.support.design.widget.NavigationView
android:id="@+id/navigation_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="right"
android:foregroundGravity="right"
app:headerLayout="@layout/header"
app:menu="@menu/drawer" />
抽屜佈局:
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".MainActivity"
android:layout_gravity="right">
菜單:
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<group android:checkableBehavior="single">
<item
android:id="@+id/one"
android:checked="false"
android:icon="@drawable/account"
android:title="First Item"></item>
<item
android:id="@+id/two"
android:checked="false"
android:icon="@drawable/filter"
android:title="Second Item"></item>
<item
android:id="@+id/three"
android:checked="false"
android:icon="@drawable/human"
android:title="Third Item"></item>
</group>
在此先感謝
它在API 21上完美工作,謝謝,但任何其他想法的前API 17? –
@AliSadeghi以前的API我將不得不多花一些時間 –
謝謝你,等待你的回覆... –