android-navigationview

Disable icon colorStateList in NavigationView

核能气质少年 提交于 2019-11-27 11:28:36
In my app today I have icons which doesn't just have a single color, but in some cases two colors depending on the data state in my app. This means I can't use the default tinting behavior in NavigationView . It looks like with the new NavigationView , unless I specify a ColorStateList for my icons used in the list, a default ColorStateList will be made for me which uses my colorPrimary etc defined in my theme. Is there no way for me to force NavigationView to stop tinting my icons? Is there no way for me to force NavigationView to stop tinting my icons? There sure is. You can do so

NavigationView: how to insert divider without subgroup?

纵饮孤独 提交于 2019-11-27 04:06:12
问题 How I can put a divider without title Subgroup in the new NavigationView? <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <group android:checkableBehavior="single"> <item android:id="@+id/drawer_armario" android:icon="@drawable/armario" android:title="@string/armario" /> <item android:id="@+id/drawer_amigos" android:icon="@drawable/amigos" android:title="@string/amigos" /> </group> <item android:title="Configuración"> <menu> <item

Android NavigationView: reduce space between icon and text and `itemBackground` not working

﹥>﹥吖頭↗ 提交于 2019-11-27 02:45:13
问题 Is there a way to reduce the space between the icon and text in the NavigationView when its built using a menu xml? I've tried to text android:drawablePadding using the app:itemTextAppearance attribute and that doesn't work, I've tried setting the padding and margins and nothing works. Also, when I set app:itemBackground and set the checked state, the entire menu item doesn't highlight, I get something like the picture below. The xml used to create the itemBackground is: <selector xmlns

Navigation Drawer Menu Item Title Color in Android

耗尽温柔 提交于 2019-11-27 01:51:23
问题 I have a problem changing the Menu Item Title Color in the Navigation Drawer I set the itemTextColor but it only changes the Color of the Items not the Title of the menu. Here is my Activity_main.xml <?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" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/drawer_layout" android:layout_width="match

How can I change separator color in NavigationView?

淺唱寂寞╮ 提交于 2019-11-27 00:20:12
I'm trying to use NavigationView to implement NavigationDrawer. I have added the separator by setting group id in menu. However I can't see the separator. I guess it is because the separator color is same as the background. So I want to change the separator color. But I find no way to change it. Can anyone help me? In screenshot, it seems have a room for separator between History and Settings , but you can't see it. activity_main.xml <?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http:/

In android how to set navigation drawer header image and name programmatically in class file?

谁都会走 提交于 2019-11-26 18:52:19
问题 In android studio 1.4.1, I have created new Navigation Drawer Project which is default.My issue is in this project there is nav_header_main.xml file which is for navigation header image and name. I want this image and name should be set programmatically in my main class activity. How to do this, I tried lot but the app crashes. nav_header_main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout android:layout_width="match_parent" android:id="@+id/headerView" android:layout_height="@dimen

NavigationView and custom Layout

寵の児 提交于 2019-11-26 17:07:45
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.NavigationView android:id="@+id/nav_view" android:layout_height="match_parent" android:layout_width="wrap_content" android:layout

Android support v23.1.0 update breaks NavigationView get/find header

主宰稳场 提交于 2019-11-26 16:06:07
问题 I have been using the v23.0.1 support library until now with no problems. Now when I switch to the new v23.1.0 library I am getting a null pointer on widgets in the drawer layout. mNavigationView = (NavigationView) findViewById(R.id.navigation_view); TextView username = (TextView) mNavigationView.findViewById(R.id.username_textView); // ^^^^^^^^ is now null when using new library // which causes the following to fail username.setText(mUser.getName()); activity layout <?xml version="1.0"

Disable icon colorStateList in NavigationView

…衆ロ難τιáo~ 提交于 2019-11-26 15:35:35
问题 In my app today I have icons which doesn't just have a single color, but in some cases two colors depending on the data state in my app. This means I can't use the default tinting behavior in NavigationView . It looks like with the new NavigationView , unless I specify a ColorStateList for my icons used in the list, a default ColorStateList will be made for me which uses my colorPrimary etc defined in my theme. Is there no way for me to force NavigationView to stop tinting my icons? 回答1: Is

How can I change separator color in NavigationView?

对着背影说爱祢 提交于 2019-11-26 09:23:12
问题 I\'m trying to use NavigationView to implement NavigationDrawer. I have added the separator by setting group id in menu. However I can\'t see the separator. I guess it is because the separator color is same as the background. So I want to change the separator color. But I find no way to change it. Can anyone help me? In screenshot, it seems have a room for separator between History and Settings , but you can\'t see it. activity_main.xml <?xml version=\"1.0\" encoding=\"utf-8\"?> <android