【问题标题】:BottomNavigationView not display properlyBottomNavigationView 无法正确显示
【发布时间】:2019-05-04 16:24:33
【问题描述】:

我想删除导航栏到屏幕底部的多余空间。

如下所示:

我的BottomNavigationView 在它下面留了一些空间,我不知道为什么。

包含BottomNavigationView的布局很简单:

<?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"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:id="@+id/layout"
  tools:context=".NavBarActivity">


<FrameLayout
    android:id="@+id/frame_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_above="@+id/menu"
    android:background="@drawable/scroll_background"/>

    <android.support.design.widget.BottomNavigationView
        android:id="@+id/menu"
        android:layout_width="match_parent"
        android:layout_height="56dp"
        android:layout_alignParentBottom="true"
        android:layout_alignParentStart="true"
        android:background="@drawable/main_color_background"
        app:itemIconTint="@color/secondaryTextColor"
        app:itemTextColor="@color/secondaryTextColor"
        app:menu="@menu/nav_items" />
</RelativeLayout>

我检查了问题不是来自导航栏的自定义背景(我用一些简单的颜色检查了它,我得到了相同的结果)

关于为什么会发生这种情况以及如何防止它发生的任何想法?

【问题讨论】:

    标签: android android-layout android-bottomnavigationview


    【解决方案1】:

    为什么你的导航背景是圆形的?

    你用main_color_background做圆形背景吗?

    删除使它成为圆形的背景,然后重试。可能是您在那些背景中添加了一些填充/边距,这会留下空间。

    【讨论】:

    • 感谢您的回答,但正如我在问题中所写的那样 - 我已经删除了这个圆形背景并使用了简单的纯色,但这并没有改变这个间距
    【解决方案2】:

    所以这是一个有趣的解决方案:

    在我的手机中,(galaxy j7 pro-2017)默认情况下,每个应用程序周围都有某种黑色细框,嗯,一切。

    所以我从来没有遇到过问题,只是手机的制造方式而已。

    【讨论】:

      猜你喜欢
      • 2014-04-23
      • 2018-06-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多