Skip to content

Commit

Permalink
Fix Navigation Drawer's text color.
Browse files Browse the repository at this point in the history
Originally it was black, now it's using the primary color.

The reason is that between material 1.2.1 and 1.8.0, the NavigationView constructor has changed. In particular textAppearanceSet was set to true, which didn't set up the itemTextColor, even though the textAppearance was 0. This was because the `app:itemTextAppearance="?attr/titleTextAppearance"` line in the XML was resolving to nothing, because the attribute is not meant to be used outside of a Toolbar.
  • Loading branch information
TWiStErRob committed Mar 16, 2023
1 parent b30b5cb commit d407282
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public boolean trigger(@IdRes int id) {
}

public void addIcons() {
// app:itemIconTint="@null" triggers !hasValue in NavigationView constructor, which creates default.
nav.setItemIconTintList(null);
Menu menu = nav.getMenu();
for (int i = 0; i < menu.size(); ++i) {
Expand Down
2 changes: 1 addition & 1 deletion android/src/main/res/layout/inc_drawer_left_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
android:layout_width="@dimen/design_navigation_width"
android:layout_height="match_parent"
android:layout_gravity="start"
app:itemTextAppearance="?attr/titleTextAppearance"
app:itemTextColor="@color/primaryBodyText"
app:menu="@menu/main_drawer"
tools:context=".activity.DrawerActivity"
/>

0 comments on commit d407282

Please sign in to comment.