我正在使用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" />
Run Code Online (Sandbox Code Playgroud)
抽屉布局:
<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">
Run Code Online (Sandbox Code Playgroud)
菜单:
<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>
Run Code Online (Sandbox Code Playgroud)
提前致谢