Android DrawerLayout и NavigationView не полностью раскрыты - PullRequest
0 голосов
/ 09 февраля 2020

Привет! Я создал DrawerLayout с NavigationView и панелью инструментов. Проблема в том, что NavigationView не раскрывается полностью, как на картинке. Я пытался использовать android: fitsSystem Windows = true и false, но ничего не получалось. enter image description here

Это мой код в файле макета.

    <?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"
    tools:context=".view.MainActivity">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        >

        <FrameLayout
            android:id="@+id/frame_sceneform_fragment"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent">

            <fragment
                android:id="@+id/sceneform_fragment"
                android:name="com.google.ar.sceneform.ux.ArFragment"
                android:layout_width="match_parent"
                android:layout_height="match_parent" />
        </FrameLayout>


        <FrameLayout
            android:id="@+id/frame_menu_nav_host"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginTop="100dp"
            android:background="#FFFFFF"
            android:visibility="invisible"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent">
            <androidx.drawerlayout.widget.DrawerLayout
                android:id="@+id/drawer_layout"
                android:layout_width="match_parent"
                android:layout_height="match_parent">
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:orientation="vertical">
                    <androidx.appcompat.widget.Toolbar
                        android:id="@+id/toolbar"
                        android:layout_width="match_parent"
                        android:layout_height="?attr/actionBarSize"
                        />

                    <fragment
                        android:id="@+id/fragment_menu_nav_host"
             android:name="androidx.navigation.fragment.NavHostFragment"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        app:defaultNavHost="true"
                        app:navGraph="@navigation/menu_navigation" />
                </LinearLayout>
                <com.google.android.material.navigation.NavigationView
                    android:id="@+id/nav_view"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_gravity="start"
                    app:menu="@menu/hamburger_menu"/>
            </androidx.drawerlayout.widget.DrawerLayout>

        </FrameLayout>
    </androidx.constraintlayout.widget.ConstraintLayout>
</layout>

Я хочу удалить серые области, где обычно находится строка состояния, и серую область внизу, предназначенную для кнопок действий на мобильном устройстве. Это возможно, или я должен сделать индивидуальный дизайн?

1 Ответ

0 голосов
/ 09 февраля 2020

Поместите новый стиль в свой стиль. Папка xml вот так;

    <style name="AppTheme.NoActionBar" >
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
</style>

и определите ее в файле манифеста как;

<activity android:name=".MainActivity"
        android:theme="@style/AppTheme.NoActionBar">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
...