android - BottomNavigationView 与最后一项重叠

标签 android android-layout

我的 XML 布局如下:

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/coordinatorLayout"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <!-- AppBar Layout   -->
    <android.support.design.widget.AppBarLayout
        android:id="@+id/appBarLayout"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="fill_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:layout_scrollFlags="scroll|enterAlways"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light" >
            <Button
                android:id="@+id/filter_location"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                style="?android:attr/borderlessButtonStyle"
                android:drawableRight="@drawable/ic_filter_list_white_24dp"
                android:layout_gravity="right"
                />
        </android.support.v7.widget.Toolbar>
        <!-- Tab Layout for creating tabs -->
        <android.support.design.widget.TabLayout
            android:id="@+id/tabLayout"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" />
    </android.support.design.widget.AppBarLayout>
    <!-- Helps handing the Fragments for each Tab -->
    <android.support.v4.view.ViewPager
        android:id="@+id/viewPager"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior" />

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/float_search"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:layout_marginBottom="70dp"
        android:src="@android:drawable/ic_menu_search" />

    <android.support.design.widget.BottomNavigationView
        android:id="@+id/bottom_navigation"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:background="@color/colorPrimary"
        app:itemBackground="@color/colorPrimary"
        app:itemIconTint="@color/windowBackground"
        app:itemTextColor="@color/windowBackground"
        app:menu="@menu/bottom_navigation_main" />
</android.support.design.widget.CoordinatorLayout>

BottomNavigationView 与内容中的最后一项重叠。我应该如何解决这个问题?如何制作 BottomNavigation 栏上方的最后一项?我试过在里面添加线性布局但仍然没有用。

最佳答案

尝试将其放在相对布局中,并在 View 分页器中使用以下属性。

android:layout_below="@+id/bottom_navigation"

关于android - BottomNavigationView 与最后一项重叠,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42572150/

相关文章:

Android 应用程序未在主屏幕上创建快捷方式图标(从 Play 商店下载)

android - @Rule > 必须是 Kotlin Junit 测试中的公共(public) ValidationError

android - 预览宽高比在不同设备上不同

Android - 如何从一个应用程序切换到另一个应用程序?

android - 如何设置 BottomSheet 完整父级的高度?

android - 将新项目计数添加到按钮上的图标 - Android

Android布局<include>,是否支持orientation layout xml文件? -land 是否有效?

android - 在 Android 中以编程方式分配 View ID

android - "Rotation Locker"是如何工作的?

java - 使用 editText 重新排序 ArrayList