navigation-drawer

How to add a collapsible menu item inside navigation drawer in android?

可紊 提交于 2019-12-09 09:44:44
问题 I have a DrawerLayout enclosing a NavigationView and this layout activity serves as a common Navigation drawer for all the activities in my app. I am providing the menu resource for app:menu in navigation view. I have some menu items, but I want one menu item to be collapsible/expandable, so that when I click on it, it expands to show two submenus and collapses again on a second click. I have added submenus by adding another <menu> inside the <item> but cant make it collapsible/expandable.

How to handle fragments saving state within ViewPager that's inside a NavigationDrawer fragment?

半城伤御伤魂 提交于 2019-12-09 07:16:12
问题 Background I have the next scenario: There is a navigation drawer with items. each switches to a different fragment. One of the fragments holds a viewPager, which holds fragments. Each of the viewPager's fragments have a ListView in it. When the user switches between the pages of the viewPager, or goes to another navigation-drawer fragment, and then back to one of the viewPager's fragment, the ListView should be restored to its original state. All that I've used is via the support library.

How to detect the touch event outside the navigation drawer

孤人 提交于 2019-12-09 06:10:50
问题 I have implemented Android Navigation drawer in my application. I am able to open/close the drawer when user touches the out side of navigation drawer. Can any one of you help me in detect the touch/click event when user touch/click out side the navigation drawer. I need to perform some functionality in that event. Please check the attached screenshot. Any help would be appriciated. 回答1: You have to handle the touch position in dispatchTouchEvent() method. Check more about touch hierarchy

Navigation Drawer statusbar

我怕爱的太早我们不能终老 提交于 2019-12-09 04:30:32
I'm having trouble making Navigation drawer over statusbar . I'm using new Design support library. In blogspot thay said: NavigationView takes care of the scrim protection of the status bar for you, ensuring that your NavigationView interacts with the status bar appropriately on API21+ devices. But it has no documentation so I'm very confused how to use Drawer to achieve desired effect. I tried inserting following attributes in my styles-v21: <item name="android:windowDrawsSystemBarBackgrounds">true</item> <item name="android:statusBarColor">@android:color/transparent</item> after this

How to select the first item in a navigation drawer and open a fragment on application start

十年热恋 提交于 2019-12-09 04:19:25
问题 I have created MainActivity with NavigationView . When Activity is opened I want to automatically select the first item in the navigation drawer and open Fragment under that item. I've searched a lot but didn't find any proper solutions. What is the proper way to do this ? Main Activity : public class MainActivity extends AppCompatActivity implements Config { private NavigationView navigationView; private DrawerLayout drawerLayout; @Override protected void onCreate(Bundle savedInstanceState)

How to put navigation drawer below toolbar?

此生再无相见时 提交于 2019-12-08 23:53:31
问题 Here my navigation drawer is above toolbar.I also added some xml code.Please help me. here is my activity.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_parent" android:fitsSystemWindows="true" tools

Up arrow does not show after calling ActionBarDrawerToggle.setDrawerIndicatorEnabled(false)

╄→гoц情女王★ 提交于 2019-12-08 23:32:34
问题 The title says it all. When I call the mDrawerToggle.setDrawerIndicatorEnabled(false) I don't want the " hamburger " icon to be shown anymore but the backwards navigation arrow. Unfortunately when I call this method just the title is shown without the backwards arrow nor the "hamburger" icon. After setting the drawerIndicatorEnabled to be true again it shows the "hamburger" icon again. I set getSupportActionBar().setDisplayHomeAsUpEnabled(true) and getSupportActionBar()

Disabling items in a Navigation Drawer in Android

匆匆过客 提交于 2019-12-08 19:25:31
I'm using the Navigation Drawer Example downloadable here . I'd like to extend this example to disable the selection of one of the planets. For simplicity, lets say I want to permanently disable the selection of Saturn, and change the text of Saturn to dark gray, and have it not highlight when a user selects it. (in reality, I would like to disable navigation programmatically when a user has changed certain values on the screen not yet saved to the device). The closest thing I've gotten to this is to stop the selectItem() method from being called from within the onItemClick click listener, but

Can't change navigation drawer icon color in android

人盡茶涼 提交于 2019-12-08 19:12:15
问题 OK, I know this is a trivial issue but for some reason it isn't working for me. I have done a lot of things suggested in other answers but in vain. My drawable folder has white color icons. I even tried to change it from styles.xml but that doesn't work either. I am testing it on my Lollipop device. Any help will be appreciated. Thanks in advance. This is a portion of my manifest file. <application android:allowBackup="true" android:icon="@drawable/ic_drawer" android:label="@string/app_name"

ActionBarDrawerToggle cannot be applied to Android.support.v7.widget.Toolbar

白昼怎懂夜的黑 提交于 2019-12-08 17:20:40
问题 I keep getting the error saying ActionBarDrawerToggle cannot be applied to v7.widget.Toolbar and because I looked at how others fixed a similar issue they are now both support library files but the error doesn't go away for some reason. The error says ActionBarDrawerToggle() in ActionBarDrawerToggle cannot be applied to android.support.v7.widget.Toolbar then under actual argument R.id.drawable_ic_drawer (int) import android.support.v7.app.ActionBarDrawerToggle; import android.support.v4.view