navigation-drawer

Set drag margin for Android Navigation Drawer

£可爱£侵袭症+ 提交于 2019-12-17 10:19:50
问题 I am using the new Navigation Drawer in my app. It is great except I have not found an easy way to set how the drawer is open. The default behavior is drag from the left edge of the screen to open. This is fine, unless the phone/table has a case on and the edge of phone can not be touched. I would like to allow the user to touch and drag from a margin of the screen to the left. This is easy to set with other nav drawer libs(Sliding lib). I have not seen anything with Google's lib

Why is my Android navigation drawer opening too wide?

时光总嘲笑我的痴心妄想 提交于 2019-12-17 10:06:48
问题 I had a rather basic navigation drawer working pretty well -- a simple ListView. But I need a title above the selectable items, so (see below) modified the XML for the drawer to be a RelativeLayout containing a TextView for a title and then the ListView for the items. What resulted is quite strange. Even though I have specified the width for all 3 (RelativeLayout, TextView and ListView) to be 240dp, which was the width of the ListView when it represented the entire drawer's XML, it looks like

Why is my Android navigation drawer opening too wide?

走远了吗. 提交于 2019-12-17 10:06:01
问题 I had a rather basic navigation drawer working pretty well -- a simple ListView. But I need a title above the selectable items, so (see below) modified the XML for the drawer to be a RelativeLayout containing a TextView for a title and then the ListView for the items. What resulted is quite strange. Even though I have specified the width for all 3 (RelativeLayout, TextView and ListView) to be 240dp, which was the width of the ListView when it represented the entire drawer's XML, it looks like

Change NavigationView items when user is logged

佐手、 提交于 2019-12-17 08:32:06
问题 My app's main activity has a navigation drawer, instantiated in the XML in this way: <android.support.design.widget.NavigationView android:id="@+id/nav_view" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="start" app:headerLayout="@layout/drawer_header" app:menu="@menu/application_drawer" android:background="@color/white"/> Now, the menu entry for the navigation drawer is the following: <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android

Change NavigationView items when user is logged

拜拜、爱过 提交于 2019-12-17 08:31:15
问题 My app's main activity has a navigation drawer, instantiated in the XML in this way: <android.support.design.widget.NavigationView android:id="@+id/nav_view" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="start" app:headerLayout="@layout/drawer_header" app:menu="@menu/application_drawer" android:background="@color/white"/> Now, the menu entry for the navigation drawer is the following: <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android

Android DrawerLayout - No drawer view found with gravity

你说的曾经没有我的故事 提交于 2019-12-17 06:12:28
问题 When I click on my drawer toggle I get the following exception: java.lang.IllegalArgumentException: No drawer view found with gravity LEFT This is my activity_drawer.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://schemas.android.com/tools" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true">

Android DrawerLayout - No drawer view found with gravity

自作多情 提交于 2019-12-17 06:12:25
问题 When I click on my drawer toggle I get the following exception: java.lang.IllegalArgumentException: No drawer view found with gravity LEFT This is my activity_drawer.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://schemas.android.com/tools" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true">

NavigationView menu items with counter on the right

亡梦爱人 提交于 2019-12-17 05:40:20
问题 The new NavigationView in the new Design Support Library works really great. They use " menu-items " to display the options. But how can I display a counter to the right of the menu item? Like in this picture: Or like in the GMail app. 回答1: Starting from version 23 of appcompat-v7 NavigationView supports action views, so it is quite easy to implement counter yourself. Create counter layout, i.e. menu_counter.xml : <?xml version="1.0" encoding="utf-8"?> <TextView xmlns:android="http://schemas

NavigationView menu items with counter on the right

不问归期 提交于 2019-12-17 05:40:06
问题 The new NavigationView in the new Design Support Library works really great. They use " menu-items " to display the options. But how can I display a counter to the right of the menu item? Like in this picture: Or like in the GMail app. 回答1: Starting from version 23 of appcompat-v7 NavigationView supports action views, so it is quite easy to implement counter yourself. Create counter layout, i.e. menu_counter.xml : <?xml version="1.0" encoding="utf-8"?> <TextView xmlns:android="http://schemas

Cannot catch toolbar home button click event

匆匆过客 提交于 2019-12-17 04:22:46
问题 I've implemented the newest appcompat library and using the Toolbar as action bar. But the problem is I cannot catch the home button / hamburger icon click event. I've tried and looked everything but doesn't seem to find a similar problem. This is my Activity class : protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); // Set up the drawer.