【问题标题】:There are some margins with NavigationBarNavigationBar 有一些边距
【发布时间】:2020-06-12 07:56:46
【问题描述】:

BottomNavigationBar 有一个问题。屏幕边缘莫名其妙的边距出现在屏幕上。

这是我的 XML 代码:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:background="#FBCEB5">


    <com.google.android.material.bottomnavigation.BottomNavigationView
        android:id="@+id/mainNavigationBar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        app:itemBackground="@color/colorPrimary"
        app:menu="@menu/main_bottom_bar"
        app:itemIconTint="@android:color/white"
        app:itemTextColor="@android:color/white"/>

</RelativeLayout>

我怎样才能穿上所有的父母宽度?请帮忙)

【问题讨论】:

标签: android xml kotlin


【解决方案1】:

根据这篇文章BottomNavigationView is not full width,底部导航栏不应该填满整个宽度。相反,您可以将视图的背景颜色设置为与项目背景相同的颜色:

<android.support.design.widget.BottomNavigationView
 android:background="@color/bottom_view_color"
 app:itemBackground="@color/bottom_view_color"

 // .... />

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-02-08
    • 1970-01-01
    • 2010-12-29
    • 1970-01-01
    • 1970-01-01
    • 2014-04-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多