How to swap icon/images of Material design navigation drawer on selection? - android

Means default all icon are in red color and on selection it should become black.I am able to change the text color on selection?
<android.support.design.widget.NavigationView
android:id="#+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginTop="#dimen/abc_action_bar_default_height_material"
android:fitsSystemWindows="true"
app:itemTextColor="#drawable/click_nav_item_change_color"
app:menu="#menu/activity_course_screen_drawer"
tools:overide="true" />

Related

Navigation drawer icon fill the transparent part of the icon with specific color

Currently i have this kind of icon in my navigation drawer
what i want to do is to put color in the transparent part of the icon.
This is the current look of my navigation drawer:
The color is outside of the transparent part of the image which is wrong.
here is my current code:
<android.support.design.widget.NavigationView
android:id="#+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="false"
app:headerLayout="#layout/main_activity_navigationdrawer_layout"
app:itemIconTint="#color/aub_red"
app:menu="#menu/activity_main_activity_menu" />

I want to change the icon in the navigation view

<item
android:id="#+id/nav_day"
android:checkable="true"
android:icon="#drawable/ic_weekly_calendar"
android:textColor="#ff00ff"
android:title="Day Planner!" />
I want to know how to change the color of the icon of the menu item I get from the navigation view. I know that you can use ItemIconTint to change at once.
I want to use the original color of the icon as it is. What should I do?
<android.support.design.widget.NavigationView
android:id="#+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
android:background="#color/colorPrimary"
app:itemIconTint="#android:color/primary_text_dark"
app:itemTextColor="#android:color/white"
app:headerLayout="#layout/nav_header_main"
app:menu="#menu/activity_main_drawer"
/>
yourNavigationView.setItemIconTintList(null);
You can check the duplicate question post here:
Disable icon colorStateList in NavigationView

How to apply selector for selected item in navigation drawer Android?

I am using navigation activity in Android studio. I have tried code below:
<android.support.design.widget.NavigationView
android:id="#+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#drawable/sidebar_bg"
android:fitsSystemWindows="true"
app:headerLayout="#layout/nav_header_main"
app:itemIconTint="#color/color_white_transperntdark"
app:itemTextColor="#color/color_white_transperntdark"
app:menu="#menu/activity_main_drawer" />
But below I need a kind of selector having some color and white vertical line. So give me a hint:

How set transparency onleft side menu in NavigationDrawerActivity

I am creating default Navigation Drawer Activity for my project. I would like set my left navigation bar transparent. Do you have any ideas how to do it?
change the the background code of NaviagtionView and him transparent
<android.support.design.widget.NavigationView
android:id="#+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
android:background="#android:color/transparent"
app:headerLayout="#layout/nav_header_main3"
app:menu="#menu/activity_main3_drawer" />

how do i assign a different backgroundcolor to all the items in a group in navigation drawer?

I have three groups in my NavigationDrawer, two of which have to stay white and the other one has to become gray.
I have seen many people say that it would be better to use a ListView to do this but I wonder if its possible with a menu?
You can provide the background color to your navigationView like below:
<android.support.design.widget.NavigationView
android:id="#+id/adcl_navigation_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#color/app_white"
app:headerLayout="#layout/drawer_header_layout"
app:itemIconTint="#color/app_secondary_text"
app:itemTextColor="#color/app_secondary_text"
app:menu="#menu/menu_drawer"
app:theme="#style/ThemeOverlay.AppCompat.Light" />
And if you want to change Single item background color then use:
<android.support.design.widget.NavigationView
android:id="#+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:itemBackground="#drawable/my_ripple"
app:itemIconTint="#2196f3"
app:itemTextColor="#009688"
app:headerLayout="#layout/nav_header"
app:menu="#menu/drawer_view" />

Categories

Resources