navigation-drawer

Android in Navigation Drawer when I click anywhere drawer closes

房东的猫 提交于 2019-11-26 14:51:15
问题 in navigation drawer, when i push a button or anything else, drawer gets closed. What is the problem? I search on internet but I didn't find anything that is different than my codes. Maybe there are some mistakes but I have not found them. codes: index.xml <?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match

Android navigation drawer toggle icon to right

六眼飞鱼酱① 提交于 2019-11-26 14:34:59
My requirement is kind of the picture below My navigation drawer should be opened from the right side . I have implemented this . My navigation drawer open from right to left . But the problem is toggle icon is always on the left side . How can I set toggle icon to the right . I have checked the following SO question , but none of them came to any help . Change toggle button image Icon In Navigation Drawer right to left Drawer Toggle in right Drawer enter link description here Here is what I have tried . code for my layout activity_main.xml <?xml version="1.0" encoding="utf-8"?> <android

Two Navigation Drawer on same Activity

旧街凉风 提交于 2019-11-26 14:29:55
问题 Is it possible to configurate two Navigation Drawers on the same activity, one from the left and the other from the right? 回答1: You can use drawer layout <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent"> <!-- The main content view --> <FrameLayout android:id="@+id/content_frame" android:layout_width="match_parent" android:layout_height=

How to create a simple divider in the new NavigationView?

狂风中的少年 提交于 2019-11-26 12:46:16
Google introduced the NavigationView in the Design Support Library version 22.2.0 with which you can create a drawer very easily using a menu resource. How can I create a simple divider line between two items? Grouping the items didn't work. Creating a sub items section does create a divider line, but it requires a title, which I don't want. Any help would be appreciated. N J All you need to do is define a group with an unique ID , I have checked the implementation if group has different id's it will create a divider. Example menu, creating the separator: <menu xmlns:android="http://schemas

How to programmatically add a submenu item to the new material design android support library

Deadly 提交于 2019-11-26 12:22:02
问题 I am trying to add new menu items to a submenu in the new Material Design drawer panel. <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\" tools:context=\".MainActivity\"> ... <android.support.design.widget.NavigationView android:id=

How to slide the ActionBar along with the NavigationDrawer

家住魔仙堡 提交于 2019-11-26 11:57:14
问题 What I want to do is slide the ActionBar along with the NavigationDrawer when the drawer is opened. I am currently not using any third party libraries and if at all possible I want to keep it that way. All i need is an implementation of method like: getActionBarView.slide(dp); This is the code I currently use to create the NavigationDrawer : mDrawerToggle = new ActionBarDrawerToggle(this, drawerLayout, R.drawable.ic_drawer, R.string.drawer_open, R.string.drawer_close) { public void

Change background color of single specific menu items of navigationView

五迷三道 提交于 2019-11-26 11:54:17
I want to set the background color of all header items in a android menu within a navigation drawer. My layout looks like: <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:title="TopItem" android:id="@+id/top_item1"> // Here i want to set the background <menu> <group> <item android:id="@+id/sub_item1" android:title="SubItem" /> // Here no background </group> </menu> </item> <item android:title="TopItem" android:id="@+id/top_item2"> <menu> <group> <item android:id="@+id/sub_item2" android:title="SubItem" /> <item android:id="@+id/sub_item3" android:title="SubItem"

Clicking hamburger icon on Toolbar does not open Navigation Drawer

烂漫一生 提交于 2019-11-26 11:38:01
问题 I have this nav drawer which was working perfectly fine. Refactoring my code I removed all onOptionsItemSelecteds in activities and made all activities inherit from a base activity which extends AppComplatActivity and implements all the necessary methods. After this clicking on hamburger icon does not work any more even though I have syncstate () and every thing. Any clues why this is not working? One of the activities: public class MainActivity extends BaseActivity implements

Android - Navigation View item menu background color

大憨熊 提交于 2019-11-26 11:09:35
问题 i try to change color of my item Navigation View menu : styles.xml <item name=\"android:activatedBackgroundIndicator\">@drawable/activated_background</item> activated_background.xml <selector xmlns:android=\"http://schemas.android.com/apk/res/android\"> <item android:state_pressed=\"true\" android:drawable=\"@color/White\" /> <item android:state_focused=\"true\" android:drawable=\"@color/White\" /> <item android:state_activated=\"true\" android:drawable=\"@color/White\" /> <item android

duplicated id with fragment

非 Y 不嫁゛ 提交于 2019-11-26 10:59:37
问题 I\'m trying to applicate drawernavigation (my first fragment is a map & the others are just some fragments with simple layouts).So it runs fine & I can navigate between my fragments but when I return to the first fragment which is a map I got a crash logcat: 11-20 11:03:27.306: E/AndroidRuntime(13787): FATAL EXCEPTION: main 11-20 11:03:27.306: E/AndroidRuntime(13787): android.view.InflateException: Binary XML file line #6: Error inflating class fragment 11-20 11:03:27.306: E/AndroidRuntime