нижняя панель навигации вместе с боковой панелью навигации - PullRequest
0 голосов
/ 14 июля 2020

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

заранее спасибо

<androidx.drawerlayout.widget.DrawerLayout
   
    android:layout_width="match_parent"
    android:layout_height="match_parent"
  >

<androidx.coordinatorlayout.widget.CoordinatorLayout
    android:layout_width="match_parent"
    android:id="@+id/coordinate_layout"
    android:layout_height="match_parent"
    >
<androidx.appcompat.widget.Toolbar
    android:layout_width="match_parent"
    android:id="@+id/toolbar_layout"
    android:layout_height="wrap_content"
    android:minHeight="?attr/actionBarSize"
    android:background="@color/cardview_dark_background"
    android:theme="@style/ThemeOverlay.AppCompat.Dark"
    />
    
    <FrameLayout
        android:id="@+id/frame"
        android:layout_width="fill_parent"
        android:layout_height="match_parent"
    />
    
</androidx.coordinatorlayout.widget.CoordinatorLayout>

    <com.google.android.material.navigation.NavigationView
        android:layout_width="match_parent"
        android:id="@+id/navigation_layout"
        android:layout_height="match_parent"
        app:headerLayout="@layout/drawer_header"
        app:menu="@menu/menu_drawer"
        android:layout_gravity="start"
        />
</androidx.drawerlayout.widget.DrawerLayout>

1 Ответ

0 голосов
/ 14 июля 2020

Поместите свои FrameLayout и BottomNavigationView в LinearLayout. Это должно исправить это.

<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout 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"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <androidx.coordinatorlayout.widget.CoordinatorLayout
        android:id="@+id/coordinate_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <androidx.appcompat.widget.Toolbar
            android:id="@+id/toolbar_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/cardview_dark_background"
            android:minHeight="?attr/actionBarSize"
            android:theme="@style/ThemeOverlay.AppCompat.Dark" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <FrameLayout
                android:id="@+id/frame"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="1" />

            <com.google.android.material.bottomnavigation.BottomNavigationView
                android:id="@+id/bottom_navigation"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="bottom"
                app:labelVisibilityMode="labeled"
                app:layout_anchorGravity="bottom"
                app:menu="@menu/bottom_navigation_menu" />

        </LinearLayout>

    </androidx.coordinatorlayout.widget.CoordinatorLayout>

    <com.google.android.material.navigation.NavigationView
        android:id="@+id/navigation_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="start" />
</androidx.drawerlayout.widget.DrawerLayout>
...