navigationview

How to get dividers in NavigationView menu without titles?

六月ゝ 毕业季﹏ 提交于 2019-11-29 06:01:43
问题 I am using the new NavigationView to create my navigation drawer menu from XML. I need to place a divider between the section menu items, which switch between the sections of my app, and the settings and help & support links at the bottom. In all the examples I've seen, I see how this can be done by putting another <menu> within an <item> , but the <item> requires to have the android:title attribute, so the best I can do is make the title blank, which leaves an empty space before the settings

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

柔情痞子 提交于 2019-11-29 05:06:23
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: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' compile "com.android.support:appcompat-v7:$

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

淺唱寂寞╮ 提交于 2019-11-29 02:06:31
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" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent"

How to change the icons direction for menu items in a NavigationView?

谁说我不能喝 提交于 2019-11-28 23:43:36
Hi I am using android NavigationView . I want to change the icons direction to RTL instead of LTR like this: How can I do this? you can use listview inside the navigationview like what i did. the benefit of this is that you can have better control on this: <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:headerLayout="@layout/header" > <ListView android:id="@+id/navigationmenu" android:layout_width="match_parent" android:layout

How to set shared checkable behavior across all groups in NavigationView?

被刻印的时光 ゝ 提交于 2019-11-28 19:43:39
问题 I've created two groups with unique ids (I need a divider) and they both have checkableBehavior set to single . This allows multiple items from different groups to be checked at once, and that's exactly what I'm trying to avoid. I'd like to have one item checked at maximum, across all groups. Since I haven't found any way to do this in XML, I tried to implement a simple logic in onNavigationItemSelected to uncheck the previous menu item: if (previousItem != null) previousItem.setChecked(false

Customising NavigationView - Adding dynamic headerView, Android Support Design Library

青春壹個敷衍的年華 提交于 2019-11-28 09:02:23
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? first create header XML like lay_header.xml <TextView android:id="@+id/tvThought" android:layout_width="wrap_content" android

Android NavigationView displays under NavigationBar, and cannot be clicked

╄→гoц情女王★ 提交于 2019-11-28 04:24:49
问题 As you can see, the background of NavigationView has been set android:clipToPadding='false' , and it can be seen under transparent NavigationBar . But the NavigationView(NavigationDrawer) cannot fully scroll up to above the NavigationBar , how to solve this? I want the list items scroll to the top of NavigationBar , which means the last Send is not under but above NavigationBar . layout/activity_main.xml <?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.DrawerLayout xmlns

How to get MenuItem position in the listener using the new NavigationView

泄露秘密 提交于 2019-11-28 03:25:19
问题 The topic says it all. How should I go about retrieving the item position on the onClick listener using NavigationView? Also, why is there no getHeader method? Lastly I am doing everything programmatically, but the header is still clickable. Any thoughts? Thanks! 回答1: UPDATE You can get position using this trick final List<MenuItem> items = new ArrayList<>(); Menu menu; NavigationView navigationView = (NavigationView) findViewById(R.id.navigation);. menu = navigationView.getMenu(); for(int i

How do I change the color of the ActionBar hamburger icon?

雨燕双飞 提交于 2019-11-28 00:55:29
问题 I'm using NavigationView from android design support library and toolbar and everything works fine, but I want to know how to make the hamburger icon dark (right now it appears white). Also I wanna adjust distance from screen edge to ActionBar Title. So how do I do this? Thanks for help. I set theme as Theme.AppCompat.Light.NoActionBar. So I use toolbar. Here is my code: public class MainActivity extends AppCompatActivity { //Defining Variables private Toolbar toolbar; private NavigationView

How to change the icons direction for menu items in a NavigationView?

早过忘川 提交于 2019-11-27 21:21:19
问题 Hi I am using android NavigationView . I want to change the icons direction to RTL instead of LTR like this: How can I do this? 回答1: you can use listview inside the navigationview like what i did. the benefit of this is that you can have better control on this: <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:headerLayout="@layout