FrameLayout重叠BottomNavigationView

时间:2017-10-16 20:57:33

标签: android android-layout

我的应用程序由顶部的AppBarLayout,中间的FrameLayout和底部的BottomNavigationView组成。起初,FrameLayout与AppBarLayout和BottomNavigationView重叠。我设法将AppBarLayout和FrameLayout分开,但似乎无法将BottomNavigationView分开。

<android.support.design.widget.CoordinatorLayout xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.jy.hi.Splash"
android:background="@color/whiteBG">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">
    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbarTop"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <TextView
                android:id="@+id/toolbar_title"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:gravity="center"
                android:text="hi"
                android:textColor="@color/talecolor"
                android:textSize="22sp" />

        </android.support.v7.widget.Toolbar>
    </android.support.design.widget.AppBarLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal">
        <FrameLayout
            android:id="@+id/frame"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

        </FrameLayout>

    </LinearLayout>

</LinearLayout>

<!--bottom-->
<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="55dp"
    android:id="@+id/bottomBar"
    android:layout_gravity="bottom">

    <com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/bottomNavView_Bar"
        android:background="@drawable/white_grey_border_top"
        app:menu="@menu/bottom_navigation_menu"
        app:itemIconTint="@color/bottom_nav_icon_color_selector"
        app:itemTextColor="@color/bottom_nav_icon_color_selector">

    </com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx>
</RelativeLayout>

1 个答案:

答案 0 :(得分:-1)

LinearLayout高度设置为match_parent

将其更改为wrap_content

(...)
<LinearLayout
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:orientation="vertical">
<android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
(...)
相关问题