簡體   English   中英

為什么底部導航欄覆蓋在應用程序屏幕布局上?

[英]Why bottom navigation bar overlay on app screen layout?

應用布局上的底部導航欄覆蓋。 我不想隱藏導航欄。 應用布局上的底部導航欄覆蓋

使用 RelativeLayout 作為父布局並使用此屬性

android:layout_below="@+id/aboveElement"

例如-

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
android:fitsSystemWindows="true"
android:orientation="vertical"
tools:context=".activity.HomeScreen">
<fragment
    android:id="@+id/my_nav_host_fragment"
    android:name="androidx.navigation.fragment.NavHostFragment"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_above="@+id/bottomNav"
    android:layout_below="@+id/topLinearHome"
    app:defaultNavHost="true"
    app:navGraph="@navigation/bottom_navigation" />

<com.google.android.material.bottomnavigation.BottomNavigationView
    android:id="@+id/bottomNav"
    android:layout_width="match_parent"
    android:layout_height="@dimen/_50sdp"
    android:layout_alignParentBottom="true"
    android:layout_gravity="bottom"
    android:background="#FFF"
    android:elevation="0dp"
    app:itemIconSize="@dimen/_20sdp"
    app:menu="@menu/bottom_menu" />
</RelativeLayout>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM