[英]AlertDialog inside a frame layout in an app with bottom navigation bar
[英]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.