简体   繁体   English

如何在没有文本的情况下对齐底部导航栏图标的中心?

[英]How to align bottom navigation bar icon center without text?

In my app, using bottom navigation bar. 在我的应用程序中,使用底部导航栏。 Inside bottom navigation bar,text not needed. 在底部导航栏中,不需要文本。 so i put android:title="" but that icon always in top. 因此我将android:title=""放到了该图标上,但该图标始终位于顶部。 how to set center? 如何设置中心? 这是我的
我需要这种类型

You can add the app:labelVisibilityMode attribute to BottomNavigationView like below. 您可以将app:labelVisibilityMode属性添加到BottomNavigationView中,如下所示。 Then it automatically center positions the icons. 然后,它将图标自动居中放置。

<android.support.design.widget.BottomNavigationView
...
app:labelVisibilityMode="unlabeled"
/>

Reference: https://developer.android.com/reference/com/google/android/material/bottomnavigation/LabelVisibilityMode 参考: https : //developer.android.com/reference/com/google/android/material/bottomnavigation/LabelVisibilityMode

Just add a space (&nbsp). 只需添加一个空格(&nbsp)。 This will consider a white space. 这将考虑空白。 Also try adding !important along with the value of property and this might also help you. 另外,尝试添加!important以及property的值,这也可能对您有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM