【发布时间】:2018-04-17 13:00:26
【问题描述】:
我需要使用两个菜单项创建底部导航。但视图比例为 30:70,文本重心居中。 一个菜单包含图像和文本一个只有文本
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/bottom_navigation_1"
android:icon="@drawable/ic_symbol1"
android:title="@string/bottom_navigation_title1"
app:showAsAction="always|withText" />
<item
android:id="@+id/bottom_navigation_2"
android:icon="@drawable/ic_symbol2"
android:title="@string/bottom_navigation_title2"
app:showAsAction="always|withText" />
主布局中的以下代码
<android.support.design.widget.BottomNavigationView
android:state_enabled="true"
android:id="@+id/home_screen_bottom_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginEnd="0dp"
android:layout_marginStart="0dp"
android:background="?android:attr/windowBackground"
app:menu="@menu/bottom_navigation1" />
【问题讨论】:
-
粘贴你的 xml 听
-
我编辑问题
-
@PrinceKumar 你解决了吗?
-
@NileshRathod 是的,使用自定义布局。感谢您的帮助
标签: android android-layout navigation-drawer bottomnavigationview android-bottomnav