I am implementing a bottom navigation menu.
(我正在实现底部导航菜单。)
but the first item in the menu is not selected. (但是没有选择菜单中的第一项。)
I notice that when I change the color of bar background then it shows, and the reason is that the first item "enabled" color is the same as the background color of my navbar. (我注意到,当我更改条形背景的颜色时,它就会显示出来,原因是第一项“启用”颜色与导航栏的背景色相同。)
How can I change the colors of the enabled tab as well as the remaining items. (如何更改已启用的选项卡以及其余项目的颜色。)
By default they're black... let's say I want to change them to white. (默认情况下,它们是黑色的。假设我要将其更改为白色。)
Thanks image of main activity. (感谢主要活动的图像。)
http://pctechtips.org/apps/activity.png menu xml file (http://pctechtips.org/apps/activity.png菜单xml文件)
<?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="@string/title_home" />
<item
android:id="@+id/navigation_dashboard"
android:icon="@drawable/ic_dashboard_black_24dp"
android:title="@string/title_dashboard" />
<item
android:id="@+id/navigation_notifications"
android:icon="@drawable/ic_notifications_black_24dp"
android:title="@string/title_notifications" />
</menu>
activity_main.xml
(activity_main.xml)
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<org.techgeorge.textrecon.PaintView
android:id="@+id/paintView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottom_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_alignParentBottom="true"
android:background="@color/colorPrimary"
app:menu="@menu/bottom_nav_menu" />
</RelativeLayout>
ask by miatech translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…