【发布时间】:2019-06-22 12:20:18
【问题描述】:
我正在构建一个带有BottomNavigationView 的应用程序,其中第一个选项卡已正确加载:
标签 1:
但是,当我切换到下一个选项卡时,框架布局似乎像这样位于工具栏下方:
标签 2:
再次进入 Tab 1:
这是我的布局:
<?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"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/bottom_navigation"/>
<android.support.design.widget.BottomNavigationView
android:id="@+id/bottom_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
app:menu="@menu/bottom_nav_menu"
app:labelVisibilityMode="unlabeled"
app:itemBackground="@color/colorPrimary"
app:itemIconTint="@color/bottom_nav_color"
app:itemTextColor="@color/bottom_nav_color" />
</RelativeLayout>
类似这样的案例还有:
Part of Fragment items hides under Action bar
但他们的解决方案在我的情况下不起作用。知道我应该改变什么吗?或者为什么工具栏失去了优先权?我已经在 Layout 中测试了自己创建一个,但它也不能正常工作。
附言
我正在加载一些 WebViews,但我怀疑它会影响。
【问题讨论】:
标签: android android-layout android-relativelayout android-framelayout bottomnavigationview