底部导航栏图标去除填充

6

我正在尝试将底部导航视图中的图标下移。例如,现在它们紧贴顶部线,如下所示:

在此处查看图像

我该如何使图标下移? 我想让它们在底部导航视图中垂直居中。

xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.example.jchousurface.mastertrack.homescreen">

<FrameLayout
    android:id="@+id/content"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1">
</FrameLayout>

<android.support.design.widget.BottomNavigationView
    android:id="@+id/navigation"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom"
    android:background="#FFFFFF"
    app:menu="@menu/navigation" />

</LinearLayout>

请问您可以发布XML代码吗? - Glory
当然,这没有什么特别的,只是基本的导航视图。 - Jeffrey Chou
@Glory 刚刚编辑了 - Jeffrey Chou
可能是如何禁用BottomNavigationView的shift模式?的重复问题。 - UgAr0FF
2个回答

3

使用

bottomNavigationView.setLabelVisibilityMode(LabelVisibilityMode.LABEL_VISIBILITY_UNLABELED);

或者
app:labelVisibilityMode="unlabeled"

0

更改BottomNavigationView中的attribute android:layout_height="40dp"或更低。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接