我正在使用 roughike 在我的Android项目中实现底部栏导航。我没有使用任何图标图像,因为我使用图像的感觉
<com.roughike.bottombar.BottomBar
android:id="@+id/menu_bottomBar"
android:layout_width="match_parent"
android:layout_height="60dp"
app:bb_titleTypeFace="fonts/fontawesome.ttf"
android:layout_alignParentBottom="true"
app:bb_tabXmlResource="@xml/bottombar_tabs" />
选项卡在bottombar_Tabs.xml
文件中定义:
<tabs>
<tab
id="@+id/tab_home"
title="\uf278" />
<tab
id="@+id/tab_chat"
title="\uf0e6" />
<tab
id="@+id/tab_globe"
title="\uf0ac" />
<tab
id="@+id/tab_friends"
title="\uf0c0" />
<tab
id="@+id/tab_profile"
title="\uf2be" />
</tabs>
导航功能按预期正常工作,但所有标签标题都显示在导航顶部。我如何使它垂直居中?我尝试使用重力,布局重力,但没有工作。感谢你的帮助,谢谢,罗宾
https://github.com/roughike/BottomBar
你可以尝试做的是改变容器的< code >重力(容器是主机选项卡< code >视图的内容,如< code>ImageView、< code>TextView等)
for (int i = 0; i < mBottomBar.getTabCount(); i++) {
mBottomBar.getTabAtPosition(i).setGravity(Gravity.CENTER_VERTICAL);
}