Adm*_*kka 4 android android-layout bottomnavigationview
我已经实现了BottomNavigationView(BNV)。我的BNV始终停留在其他视图的顶部,如何使其停留在其他视图的顶部?
这是我的看法
<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>
Run Code Online (Sandbox Code Playgroud)
这就是它所显示的。
谢谢。
编辑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>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4547 次 |
| 最近记录: |