navigationview

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

安稳与你 提交于 2019-11-26 06:18:48
问题 I wanna achieve something like this shown in the Material Design Docs. colorControlHighlight is used for the Background on checked items. I need to customize: background unchecked text color checked text color unchecked 回答1: NavigationDrawer (NavigationView) has three options for configuration of checked/selected items. app:itemIconTint="@color/menu_text_color" //icon color app:itemTextColor="@color/menu_text_color" //text color app:itemBackground="@drawable/menu_background_color" /

NavigationView and custom Layout

ぐ巨炮叔叔 提交于 2019-11-26 05:17:03
问题 I\'m using the Designs Support Libraries NavigationView like this: <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_height=\"match_parent\" android:layout_width=\"match_parent\" android:fitsSystemWindows=\"true\"> <!-- put your main layout here --> <include layout=\"@layout/drawer_main_layout\"/> <android.support.design.widget

How to create a simple divider in the new NavigationView?

冷暖自知 提交于 2019-11-26 03:35:45
问题 Google introduced the NavigationView in the Design Support Library version 22.2.0 with which you can create a drawer very easily using a menu resource. How can I create a simple divider line between two items? Grouping the items didn\'t work. Creating a sub items section does create a divider line, but it requires a title, which I don\'t want. Any help would be appreciated. 回答1: All you need to do is define a group with an unique ID , I have checked the implementation if group has different

NavigationView OnNavigationItemSelectedListener not being called

纵然是瞬间 提交于 2019-11-26 00:55:58
问题 I am trying to use NavigationView from Android Support Design library in my app. For some reason, OnNavigationItemSelected listener is not being called. Here is my code Activity Layout <?xml version=\"1.0\" encoding=\"utf-8\"?> <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\"

NavigationView get/find header layout

假如想象 提交于 2019-11-25 23:59:22
问题 In my NavigationView I have a header layout with id \'viewId\' with active buttons. To setup those buttons, I do the following in activity\'s onPostCreate : final View panel = findViewById(R.id.viewId); panel.setOnClickListener(new View.OnClickListener() { ... setup goes here ... }); With new version android support library, ( 23.1.0 ), the view can\'t be found, it returns null. With previous versions it worked well. Is it a bug or am I using this feature wrong? If so, how to access header