I need to do a bottom navigation view in Android like this:
I tried, and now I have something like this:
如何增加 + 图标的大小?它始终是静态的并且比其他图标更大。其他图标在激活时会改变颜色,但大小保持不变。
活动 XML:
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottom_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:itemBackground="@color/white"
app:layout_anchor="@id/bottom_navigation"
app:layout_constraintBottom_toBottomOf="parent"
app:labelVisibilityMode="labeled"
app:menu="@menu/bottom_navigation_main"
tools:layout_editor_absoluteX="4dp" />
底部导航视图 xml:
<item
android:id="@+id/action_home"
android:enabled="true"
android:icon="@drawable/ic_home"
android:title="@string/home"
app:showAsAction="ifRoom"/>
<item
android:id="@+id/action_notification"
android:enabled="true"
android:icon="@drawable/ic_notification"
android:title="@string/notification"
app:showAsAction="ifRoom"/>
<item
android:id="@+id/action_add"
android:enabled="true"
android:title=" "
android:icon="@drawable/ic_add_circle"
app:showAsAction="ifRoom"
app:itemIconSize="50px"/>
<item
android:id="@+id/action_schedule"
android:enabled="true"
android:title="@string/schedule"
android:icon="@drawable/ic_schedule"
app:showAsAction="ifRoom" />
<item
android:id="@+id/action_profile"
android:enabled="true"
android:title="@string/profile"
android:icon="@drawable/ic_profile"
app:showAsAction="ifRoom" />
您可以通过使用底部栏顶部的“浮动操作按钮”来实现您正在尝试的操作。
底部栏中的第三个项目可以只是一个占位符。上面没有任何操作、名称和图标。
例如,顶部有一个浮动操作按钮的布局如下所示this https://stackoverflow.com/questions/52026043/why-floating-action-button-behind-the-bottombar帖子,请参阅帖子以获取有关您可能面临的相同问题的更多信息。
您还可以看一下this https://medium.com/material-design-in-action/implementing-bottomappbar-material-components-for-android-f490c4a01708。较新的 Google 底部栏包含浮动操作按钮的功能。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)