Java Code Examples for com.google.android.material.navigation.NavigationView#setItemTextColor()
The following examples show how to use
com.google.android.material.navigation.NavigationView#setItemTextColor() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NavigationViewActions.java From material-components-android with Apache License 2.0 | 6 votes |
/** Sets item text color on the content of the navigation view. */ public static ViewAction setItemTextColor(final ColorStateList textColor) { return new ViewAction() { @Override public Matcher<View> getConstraints() { return isDisplayed(); } @Override public String getDescription() { return "Set item text color"; } @Override public void perform(UiController uiController, View view) { uiController.loopMainThreadUntilIdle(); NavigationView navigationView = (NavigationView) view; navigationView.setItemTextColor(textColor); uiController.loopMainThreadUntilIdle(); } }; }
Example 2
Source File: ThemePrefs.java From Easy_xkcd with Apache License 2.0 | 6 votes |
public void setupNavdrawerColor(NavigationView navigationView) { int[][] state = new int[][]{ new int[]{-android.R.attr.state_checked}, new int[]{} }; int[] color = new int[]{ getNavDrawerTextColor(), getNavDrawerHightlightColor() }; int[] colorIcon = new int[]{ getColor(android.R.color.tertiary_text_light), getNavDrawerHightlightColor() }; navigationView.setItemTextColor(new ColorStateList(state, color)); navigationView.setItemIconTintList(new ColorStateList(state, colorIcon)); }
Example 3
Source File: NavigationViewUtil.java From a with GNU General Public License v3.0 | 5 votes |
public static void setItemTextColors(@NonNull NavigationView navigationView, @ColorInt int normalColor, @ColorInt int selectedColor) { final ColorStateList textSl = new ColorStateList( new int[][]{ new int[]{-android.R.attr.state_checked}, new int[]{android.R.attr.state_checked} }, new int[]{ normalColor, selectedColor }); navigationView.setItemTextColor(textSl); }
Example 4
Source File: NavigationViewUtil.java From MyBookshelf with GNU General Public License v3.0 | 5 votes |
public static void setItemTextColors(@NonNull NavigationView navigationView, @ColorInt int normalColor, @ColorInt int selectedColor) { final ColorStateList textSl = new ColorStateList( new int[][]{ new int[]{-android.R.attr.state_checked}, new int[]{android.R.attr.state_checked} }, new int[]{ normalColor, selectedColor }); navigationView.setItemTextColor(textSl); }