navigationview

Open NavigationView on Right Swipe from everywhere on the layout

痴心易碎 提交于 2019-12-11 11:17:26
问题 I would like to open the navigationview on a right swipe, no matter where the right swipe is. Default you have to make the right swipe quite at the side, but I want to swipe for example from the middle to open the navigationview 回答1: you could either increase the swipe edge of the drawer using something like this public static void increaseSwipeEdgeOfDrawer(DrawerLayout mDlSearchDrawer) { try { Field mDragger = mDlSearchDrawer.getClass().getDeclaredField( "mRightDragger");//mRightDragger or

Null Pointer Exception on Navigation Header Initialized Variables [duplicate]

北慕城南 提交于 2019-12-11 10:56:20
问题 This question already has answers here : What is a NullPointerException, and how do I fix it? (12 answers) Closed 3 years ago . Why am i getting Null Pointer Exceptions on my NavigationView header initialized variables while setting the values from shared preferences? Here is my code private void setNavigationHeader() { View navHeader = mNavigationView.getHeaderView(0); TextView mProfileName = (TextView) navHeader.findViewById(R.id.profile_name); TextView mProfileEmail = (TextView) navHeader

NavigationView has erratic behavior with selection

懵懂的女人 提交于 2019-12-11 03:34:08
问题 OK, the behavior or my NavigationView works. I click on the settings and it takes me there. I click on my first item, it does what it should. I click on the second item, it does what it should. However, my issue is with the selection state. I will click on an item, and it will not select it. The only selection that works is my Settings menu. When I click on that item, the settings menu will become selected, along with all previous items I clicked on. Scenarios On App Load Go to NavigationView

Android Navigation View transparency

為{幸葍}努か 提交于 2019-12-11 03:01:34
问题 everyone. Is it possible to make Navigation View transparent? I have custom layout and try to set 50% transparent background for this layout, Navigation View or Drawer Layout . android:background="#80000000" but it doesn't give expected result. Anybody tried to do this? I would appreciate help. 回答1: you can try: navigationView.getBackground().setAlpha(122); Here you can set the opacity between 0 (fully transparent) to 255 (completely opaque). you can also use XML value alpha that takes double

remove line divider from NavigationView android

情到浓时终转凉″ 提交于 2019-12-11 00:20:09
问题 i have this menu for the NavigationView of layout: <item android:title="title1"> <menu> <item android:id="@+id/nav_tab1" android:icon="@drawable/ic_action_nav_tab1" android:title="test1" /> <item android:id="@+id/nav_tab2" android:icon="@drawable/ic_action_nav_tab2" android:title="test2" /> </menu> </item> <item android:title="title2"> <menu> <item android:id="@+id/nav_settings" android:icon="@drawable/ic_action_settings" android:title="test3" /> </menu> </item> how can remove the line

How to listen to long click on a navigationview item?

六眼飞鱼酱① 提交于 2019-12-10 16:09:32
问题 I'm developing an android app using design library and appCompat library. I'm facing some issues when tried to listen to long click on a menu item. My app has a NavigationView as a side menu, inside this navigationview I had a menu with a lot of items. I can listen to click of these items but I can't listen to the long click. Does anybody know how do I implement it? Thanks. 回答1: update You can use: Menu myMenu = navigationView.getMenu(); MenuItem myItem = myMenu.findItem(R.id.my_item); myItem

Android - Material Design - NavigationView - How to put vertical scroll?

狂风中的少年 提交于 2019-12-08 01:36:52
问题 i'm using NavigationView with compile 'com.android.support:design:22.2.1' Well, everything is good unless it hasn't vertical scroll How do I set it via xml? 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_parent" android:layout_height="match

how to change menu item gravity to right in NavigationView

被刻印的时光 ゝ 提交于 2019-12-07 17:35:24
问题 I need to put a menu item icon at right of text (by default it's on the left side) so how to change menu item gravity to right in NavigationView ? because we can not custom NavigationView Items,I think it's impossible. can any one help me. my menu xml file is: <menu xmlns:android="http://schemas.android.com/apk/res/android"> <group android:id="@+id/menu_group_2"> <item android:id="@+id/menu_settings" android:title="Settings" /> <item android:id="@+id/menu_about" android:title="About" /> <

NavigationView slow to open / Skipping frames (Android Design Lib)

拟墨画扇 提交于 2019-12-07 06:07:19
问题 I'm using a NavigationView supplied by the Android Design Library. I've found after adding a few items to it that is performing quite poorly. On first launch it takes a second or so to open for the firs time. Here's a screenshot of the UI. I'll try to post some of the relevant bits of code. Drawer XML <group android:checkableBehavior="single"> <item android:id="@+id/home" android:checked="false" android:icon="@drawable/ic_home" android:title="Home" /> <item android:id="@+id/about" android

uwp NavigationView control Titlebar

隐身守侯 提交于 2019-12-06 12:59:40
问题 I have a problem with the NavigationView Control and the titlebar. I have tried to extend the view into the titlebar to play with the acrylic effects of the standard NavigationView. But then I´ve noticed that the back and menu buttons are underneath the titlebar, so you´re not able to click them properly. In the attached image, you can see that everything under the red line is clickable but when you go over it, you are targeting the titlebar. Is there anything I can do to fix this behavior?