0
我在我的应用程序中使用底部导航栏。它包含3个项目如下:Android,BottomNavigationView,为每个项目设置重量?
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.example.MainActivity">
<FrameLayout
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="#ffffff"
android:layout_weight="9">
<GridView
android:id="@+id/gvMain"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:numColumns="3" />
</FrameLayout>
<android.support.design.widget.BottomNavigationView
android:id="@+id/navigation"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="bottom"
android:layout_weight="1"
android:background="?android:attr/windowBackground"
android:backgroundTint="#f5f5f5"
app:menu="@menu/navigation" />
</LinearLayout>
这里有“@菜单/导航”代码:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/navigation_home"
android:icon="@drawable/ic_home_black_24dp"
android:title="Button1"/>
<item
android:id="@+id/navigation_dashboard"
android:icon="@drawable/ic_dashboard_black_24dp"
android:title="Button2"/>
<item
android:id="@+id/navigation_notifications"
android:icon="@drawable/ic_notifications_black_24dp"
android:title="Button3"/>
</menu>
现在我想以某种方式有中间的按钮采取提供的半空间和另外两个分享另一半。但是没有重量属性存在。换句话说,我想将按钮2的布局权重设置为2,将按钮1和按钮3的权重设置为1.有没有办法做到这一点?
任何帮助或技巧值得赞赏。
下面是可能有助于形状:
当前布局:
我的目标就是要改变这样的:
你可以发布图像设计? –
我更新了问题。 – Josh