Эх сурвалжийг харах

Color selected bottom nav item with accent color when theme isn't blue

arkon 4 жил өмнө
parent
commit
371b0b2132

+ 8 - 0
app/src/main/res/color/bottom_nav_selector.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Based on mtrl_bottom_nav_colored_item_tint
+-->
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:alpha="1.0" android:color="?attr/colorAccentOnPrimary" android:state_checked="true"/>
+    <item android:alpha="0.6" android:color="?attr/colorOnPrimary"/>
+</selector>

+ 3 - 1
app/src/main/res/layout/main_activity.xml

@@ -44,9 +44,11 @@
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_gravity="bottom"
+        app:itemIconTint="@color/bottom_nav_selector"
+        app:itemTextColor="@color/bottom_nav_selector"
         app:labelVisibilityMode="labeled"
-        app:layout_insetEdge="bottom"
         app:layout_behavior="@string/hide_bottom_view_on_scroll_behavior"
+        app:layout_insetEdge="bottom"
         app:menu="@menu/bottom_nav" />
 
 </androidx.coordinatorlayout.widget.CoordinatorLayout>