FrameLayout中的每个底部内容都隐藏在bottomNavigation后面,下面是我的代码.....我正在制作一个有点复杂的应用程序,它具有抽屉布局和bottomnavigation,我也使用framelayout来显示不同的片段,当菜单项从底部导航单击时,问题是我是否使用constraintLayout或线性布局(不作为rootlayout)而不是FrameLayout和bottomNavigation上方的RelativeLayout它仍然隐藏我的所有片段底部内容,无论是recyclerview还是button
<?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:id="@+id/drawerLayoutID"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/frame_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottom_navigation_ID"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_gravity="bottom|end"
android:background="?android:attr/windowBackground"
app:layout_behavior="@string/hide_bottom_view_on_scroll_behavior"
android:foreground="?attr/selectableItemBackground"
app:itemIconTint="@color/bottom_navigation_color"
app:labelVisibilityMode="unlabeled"
app:menu="@menu/navigation"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="start"
android:id="@+id/checkCon"
android:layout_weight="1"
android:background="@color/navyBlue">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@color/favoriteColor">
<EditText
android:id="@+id/search_editText_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="16dp"
android:background="@drawable/rounded_corner_backgrond"
android:hint="@string/search"
android:paddingLeft="10dp"
android:paddingBottom="10dp"
android:paddingTop="10dp"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/all_button_id"
android:layout_below="@id/search_editText_id"
android:textColor="@color/whiteColor"
android:text="@string/selectAll"
android:textAllCaps="false"
android:layout_marginTop="10dp"
android:layout_centerHorizontal="true"
android:background="@android:color/transparent"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/search_RecylerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/all_button_id" />
</RelativeLayout>
</RelativeLayout>
</androidx.drawerlayout.widget.DrawerLayout>
1条答案
按热度按时间1aaf6o9v1#
您只需将框架布局的底部约束提供给底部导航的顶部,这样框架布局的底部内容就不会隐藏在底部导航后面。
参考此代码将解决您的挑战。