android - BottomNavigationView:更改标题和图标之间的间隙大小
问题描述
我想改变BottomNavigationView
高度,改变尺寸后项目位置不会改变。
这更像是中间间隙不会自动改变。但是,我想更改此间隙大小。
这是我的代码:
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/nav_view"
style="@style/MyBottomNavigationView"
android:layout_width="0dp"
android:layout_height="?android:listPreferredItemHeightSmall"
android:background="?android:attr/windowBackground"
app:itemIconSize="20dp"
app:labelVisibilityMode="labeled"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:menu="@menu/bottom_nav_menu" />
<com.google.android.material.bottomnavigation.BottomNavigationView ...
如果你们知道更好的图书馆,我也在使用,请建议我。
解决方案
BottomNavigationView
通过覆盖以下尺寸来更改高度
<dimen name="design_bottom_navigation_height" tools:override="true">40dp</dimen>
这将增加/减少图标和文本之间的间隙大小。
推荐阅读
- javascript - 在 for 循环中使用 Promise,所有的 .then 总是被调用,直到所有第一个 .then 完成运行,这是为什么呢?
- ms-access - 前端,具有不同 Access 和 Windows 版本的多个用户
- php - Laravel SEO 友好的 URL
- javascript - 如何将函数作为道具传递给 React 组件?
- node.js - 在 mongoose 的模式类型中使用 TypeScript 类型
- jmeter - JMeter - 50% 拆分并采取相关路径
- java - java jdbc如何映射一个List
到 postgres 数组 - sql - 基于 Excel 中的变量的 Excel VBA 到 SQL 存储过程失败
- cmake - CMAKE 定义依赖
- python - 将空字符串转换为浮点数