Change Navigation View Item Color Dynamically Android

use app:itemIconTint in your NavigationView for icons and use app:itemTextColor for textColors Sample : drawable/navigation_text_color : <selector xmlns:android=”http://schemas.android.com/apk/res/android”> <!– This is used when the Navigation Item is checked –> <item android:color=”#009688″ android:state_checked=”true” /> <!– This is the default text color –> <item android:color=”#E91E63″ /> </selector> and layout : <android.support.design.widget.NavigationView . . app:itemTextColor=”@drawable/navigation_text_color”/>

How animate Burger to Arrow with Appcompat v7 21, Toolbar and DrawerLayout

Have a look here, it describes how you solve it. https://stackoverflow.com/a/26447144 The essential part is the following: <style name=”AppTheme” parent=”Theme.AppCompat.Light”> <item name=”drawerArrowStyle”>@style/DrawerArrowStyle</item> </style> <style name=”DrawerArrowStyle” parent=”Widget.AppCompat.DrawerArrowToggle”> <item name=”spinBars”>true</item> <item name=”color”>@android:color/white</item> </style>

ClassCastException android.widget.FrameLayout$LayoutParams to android.support.v4.widget.DrawerLayout$LayoutParams

What solved this issue for me: In MainActivity, add a new field for the LinearLayout, and assign value to it in onCreate() (this part just like emaleavil suggested): private LinearLayout linearLayout; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // … linearLayout = (LinearLayout) findViewById(R.id.linearLayout); } Then in selectItem(), when calling closeDrawer(), simply pass linearLayout as … Read more

How do I make DrawerLayout to display below the Toolbar?

<LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:app=”http://schemas.android.com/apk/res-auto” android:orientation=”vertical” android:layout_width=”match_parent” android:layout_height=”match_parent”> <!– The toolbar –> <android.support.v7.widget.Toolbar android:id=”@+id/my_awesome_toolbar” android:layout_height=”wrap_content” android:layout_width=”match_parent” android:minHeight=”?attr/actionBarSize” android:background=”?attr/colorPrimary” /> <android.support.v4.widget.DrawerLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:id=”@+id/my_drawer_layout” android:layout_width=”match_parent” android:layout_height=”match_parent”> <!– drawer view –> <LinearLayout android:layout_width=”304dp” android:layout_height=”match_parent” android:layout_gravity=”left|start”> <!– drawer content –> </LinearLayout> <!– normal content view –> <LinearLayout android:layout_width=”match_parent” android:layout_height=”match_parent” android:orientation=”vertical”> <!– The rest of content view –> </LinearLayout> </android.support.v4.widget.DrawerLayout> </LinearLayout>

How to customize item background and item text color inside NavigationView?

itemBackground, itemIconTint and itemTextColor are simple xml-attributes that can be set, though you have to use a custom prefix instead of the android: one. Example <android.support.v4.widget.DrawerLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:app=”http://schemas.android.com/apk/res-auto” android:id=”@+id/drawer_layout” android:layout_width=”match_parent” android:layout_height=”match_parent” android:fitsSystemWindows=”true”> <!– Other layout views –> <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” /> </android.support.v4.widget.DrawerLayout> Note: In this case the … Read more

DrawerLayout Double Drawer (Left and Right Drawers simultaneously)

Here is the code for a Double Drawer Activity than can be extended by other activities to implement the double drawer, assuming they have a layout like the one propposed by OP. public class DoubleDrawerActivity extends ActionBarActivity { private DrawerLayout mDrawerLayout; private ActionBarDrawerToggle mDrawerToggle; private View mLeftDrawerView; private View mRightDrawerView; @Override protected void onCreate(Bundle savedInstanceState) … Read more