navigationview

Android KitKat: android.view.InflateException: Error inflating class android.support.design.widget.NavigationView

时光总嘲笑我的痴心妄想 提交于 2019-11-27 18:45:56
问题 Below is my configuration. This works on Android Lollipop but crash on Android Kitkat. I tried every workaround here but can't help: Error inflating class android.support.design.widget.NavigationView build.gradle android { compileSdkVersion 23 buildToolsVersion "23.0.2" defaultConfig { minSdkVersion 14 targetSdkVersion 23 // Support RenderScript Library v8 renderscriptTargetApi 18 renderscriptSupportModeEnabled true } } ext{ supportLibVersion = '23.1.1' } dependencies { compile fileTree(dir:

ClassNotFoundException: Didn't find class “android.support.design.R$styleable”

我的梦境 提交于 2019-11-27 16:24:52
问题 Hi I am using NavigationView but I am getting error, below is my xml, I have already included android support and v7 library project.properties as I am not using Android studio target=android-22 android.library.reference.1=../android-support-v7-appcompat android.library.reference.2=../design <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto"

NavigationView: how to insert divider without subgroup?

你。 提交于 2019-11-27 14:37:00
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:id="@+id/drawer_ajustes" android:icon="@drawable/ajustes" android:title="@string/ajustes" /> <item

Default Navigation Drawer View to ExpandableListView

孤者浪人 提交于 2019-11-27 13:45:26
In Android Studio 2.1.2, if i create a default navigation activity I get this view: Which uses the following activity_main.xml file: <?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_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" tools:openDrawer="start"> <include layout="@layout/app_bar_main" android:layout_width="match

Change Navigation View Item Color Dynamically Android

こ雲淡風輕ζ 提交于 2019-11-27 13:17:17
I'd like to build a navigation drawer where each item has a different selection color (the icon tint and text color) as the google play store has: I'm not sure how they've solved this, I think they use different activities with different drawers. I want to use fragments and I want to change the icon tint and text color. Any ideas how I can do this? I'm using google's design support library and a drawer layout with a navigation view in there. use app:itemIconTint in your NavigationView for icons and use app:itemTextColor for textColors Sample : drawable/navigation_text_color : <selector xmlns

Is there any way to control views inside NavigationView header?

三世轮回 提交于 2019-11-27 13:09:25
As the title says, I want to know if there is any way to control views inside the NavigationView header? (Except for adding or removing header.) For example: In the header, I have a user avatar. By default, it displays a guest image, but after the user logs in, the real avatar will be showed. How can this be accomplished? After updating your support library to version 23.1.1 or above, You could do this - View header = navigationView.getHeaderView(0); TextView text = (TextView) header.findViewById(R.id.textView); or if you have multiple headers navigationView.getHeaderCount() Ref : https://code

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

拟墨画扇 提交于 2019-11-27 12:40:40
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" encoding="utf-8"?> <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res

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

How to set custom typeface to items in NavigationView?

我是研究僧i 提交于 2019-11-27 02:38:12
With the new NavigationView , we are able to set a drawer's items through a menu resource in XML. With that, we can set each item with something like <item android:id="@+id/drawer_my_account" android:icon="@drawable/ic_my_account" android:title="@string/drawer_my_account" /> But now, I want to set a custom typeface to each of those items in my drawer, and I could not find a way to do that, either by XML or by Java code. Is there a way to do it? just add following class file to your project. import android.graphics.Paint; import android.graphics.Typeface; import android.text.TextPaint; import

Customising NavigationView - Adding dynamic headerView, Android Support Design Library

半城伤御伤魂 提交于 2019-11-27 02:35:49
问题 I tried the navigationView from the new android support design library. I want to have a dynamic headerview. Basically, my headerview will show something like quote of the day. I have like around 10 quotes and i want to randomly select a quote and display in a textview in the headerView. I also want to add onClick method for the headerView. Right now, I don't see any possibilities of changing the headerview layout programmatically. Any suggestions to implement this? 回答1: first create header