我已经实现了 BottomNavigationView (BNV)。我的 BNV 总是在其他 View 之上,如何让它保持在其他 View 之下?
这是我的看法
<RelativeLayout xmlns:ads="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.BottomNavigationView
android:id="@+id/bottomNavi"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/color_bottom_navi"
app:itemBackground="@drawable/selector_navi_bottom"
app:itemIconTint="@color/colorPrimary"
app:itemTextColor="@color/colorPrimary"
app:menu="@menu/bottom_navigation" />
<FrameLayout
android:id="@+id/frm_content_full"
android:layout_width="match_parent"
android:background="@color/colorPrimaryDark"
android:layout_height="match_parent" />
</RelativeLayout>
这是它显示的内容。
谢谢。
编辑 1:BNV 下面的空间用于 AdView,我的问题是当我使用上面的代码时,屏幕会变成蓝色,BNV 会被隐藏。
最佳答案
试试这个 xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/frm_content_full"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/linear_bottombar"
android:background="@color/colorPrimaryDark" />
<LinearLayout
android:id="@+id/linear_bottombar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="vertical">
<android.support.design.widget.BottomNavigationView
android:id="@+id/bottomNavi"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/color_bottom_navi"
app:itemBackground="@drawable/selector_navi_bottom"
app:itemIconTint="@color/colorPrimary"
app:itemTextColor="@color/colorPrimary"
app:menu="@menu/bottom_navigation" />
<!--your adview-->
</LinearLayout>
</RelativeLayout>
关于android - 使 BottomNavigationView 停留在其他 View 下,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44777171/