gpt4 book ai didi

android - BottomNavigationView 图标上方显示的导航项文本

转载 作者:行者123 更新时间:2023-12-04 23:47:16 29 4
gpt4 key购买 nike

升级依赖后:

'com.google.android.material:material:x.x.x'


来自 1.4.0 1.5.0 ,导航项文本以某种方式从锚定在图标下方更改为在图标上方:
从:
enter image description here
至:
enter image description here
这是一个功能还是一个错误,这有修复吗?

最佳答案

从 1.4.0 更新到 1.5.0 后,我遇到了同样的问题,但在我的情况下,问题是因为我使用继承自 Widget.Design.BottomNavigationView 的 BottomNavigationView 的主题引起的。 :

<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bnv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/windowBackground"
android:theme="@style/Widget.BottomNavigationView"
...
/>
看完 Widget.Design.BottomNavigationView xml 我意识到在版本 1.5.0 中是 minHeight属性已添加,导致影响我们的问题。
所以我加了 <item name="android:minHeight">0dp</item>我的自定义样式是这样的:
<style name="Widget.BottomNavigationView" parent="Widget.Design.BottomNavigationView">
...
<item name="android:minHeight">0dp</item>
</style>
问题就解决了!

关于android - BottomNavigationView 图标上方显示的导航项文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70728720/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com