как изменить гравитацию меню в меню ящика? - PullRequest
0 голосов
/ 26 апреля 2020

Я использую DrawerLayout для меню ящика. Я сделал меню навигации справа налево. Но вот моя проблема: серьезность пункта меню находится на правой стороне. Но я хочу, чтобы серьезность пункта меню была слева. Я попытался изменить гравитацию в ящике и гравитацию навигации, но это не сработало. Как я могу решить эту проблему?

<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools">

    <data>
        <variable
            name="viewmodel"
            type="com.haii.quokka.main_screen.MainViewModel" />
    </data>
    <androidx.drawerlayout.widget.DrawerLayout
        android:id="@+id/drawer_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true"
        tools:context=".MainActivity"
        android:layoutDirection="rtl"
        tools:openDrawer="right">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <com.google.android.material.appbar.AppBarLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:theme="@style/AppTheme.AppBarOverlay">

            <androidx.appcompat.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:minHeight="?attr/actionBarSize"
                android:theme="?attr/actionBarTheme">
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Toolbar Title"
                    android:layout_gravity="center"
                    android:id="@+id/toolbar_title"
                    android:textStyle="bold"
                    android:textColor="@color/colorBlack"
                    android:textSize="15dp"
                    />

            </androidx.appcompat.widget.Toolbar>
        </com.google.android.material.appbar.AppBarLayout>


        <FrameLayout
            android:id="@+id/fragmentContainer"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

        </FrameLayout>
    </LinearLayout>

        <com.google.android.material.navigation.NavigationView
            android:id="@+id/navigation_view"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_gravity="right"
            android:fitsSystemWindows="true"
            android:layoutDirection="rtl"
            app:headerLayout="@layout/nav_header"
            app:menu="@menu/main_menu" />
    </androidx.drawerlayout.widget.DrawerLayout>
</layout>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...