navigation-drawer

NavigationView and ActionBarDrawerToggle

五迷三道 提交于 2019-11-29 18:45:41
问题 With the new NavigationView is it still recommended to use ActionBarDrawerToggle or is this not "Material Design"? For instance previously we were supposed to hide action bar items when the drawer was opened but now the guidelines say that they should stay. 回答1: With the new NavigationView is it still recommended to use ActionBarDrawerToggle No, it's not required. If you look at the "official" demo code for the new Design Library, ActionBarDrawerToggle is no longer used, since the new

Navigation Drawer and master/detail flow

旧城冷巷雨未停 提交于 2019-11-29 16:00:53
I try use two android templates (Navigation Drawer + Master/Details Flow). How can I use this two templates in one app? I will be grateful for any example. Kaitlyn Hanrahan Update: After being ask to do so by a moderator, I'm flagging this and another similar question (as duplicates). Those questions: How to implement navigation drawer with fragments master detail https://stackoverflow.com/questions/25403377/combine-navigation-drawer-and-master-detail-layout Original Answer: Faced with the same problem, I found a tutorial on it that actually used the two design ideas together: http://blog

How do I change Item title font color for an Item that contains a menu in Navigation Drawer

天涯浪子 提交于 2019-11-29 15:57:30
I've been searching for a way to change a specific font color in my nav drawer. I can change the font colors for other item titles but not ones containing a menu. <group android:id="something" android:checkableBehavior="single> <item android:title="Menu Heading> <--This is what I want to change--> <menu> <item android:title="stuff"/> <--This i can change--> <item android:title="stuff"/> </menu> </item> </group> I can change all other title colors with app:itemTextColor in the main activity. I've tried changing my theme's alternate font color. I'm still relatively new to programming in general,

Right to left menu items Android in NavigationView

房东的猫 提交于 2019-11-29 15:48:46
im beginer of android. i design a navigation drawer like this: as you see all items in menu are on the right Except "SubHeader". how can i move "SubHeader" item to the right of this menu? i use all properties like gravity, layout gravity, layoutDirection to the SubHeaderItem but it doesn't work. my code is <android.support.design.widget.NavigationView android:layout_width="wrap_content" android:layout_height="match_parent" android:id="@+id/navigation_view" android:layout_gravity="end" android:fitsSystemWindows="true" android:layoutDirection="rtl" app:headerLayout="@layout/navigation_header"

Navigation drawer menu item with titles and sub titles

∥☆過路亽.° 提交于 2019-11-29 15:17:06
问题 I have a navigation drawer prototype. we have heading and subheading in the same. am using menu group to include the titles. 1) just want to add sub title or help text for the navigation drawer. 2) want to customise the icon size to fit the whole heading and sub heading so it looks like the image below. <item android:id="@+id/nav_home" android:icon="@drawable/ic_menu_home" android:subtitle="View your biorhythm" <!-- This should be sub title. --> android:title="Home" /> 回答1: Inside in

Android Navigation Drawer (calling activities) with AbstractMainActivity

旧时模样 提交于 2019-11-29 14:44:45
问题 I want to have a AbstractMainActivity which creates the Navigation Drawer. In there I should also handle the clicks on the menu items and then call new activities. In those activities, I want to again use the same Navigation Drawer. I would extend in the Subclasses with the AbstractMainActivity and call the getLayoutResourceID differently from each subclass (as suggested here: android how to create my own Activity and extend it?). The problem is, that now in the AbstractMainActivity where I

How to prevent closing Navigation drawer by touch outside the drawer

孤街浪徒 提交于 2019-11-29 14:17:43
I have an Activity with Navigation Drawer. if user device is table and orientation is landscape - I not need to close drawer by click on item in drawer: if (!isTablet || context.getResources().getConfiguration().orientation==1) { mDrawerLayout.closeDrawer(Gravity.START); } It work. But if user touch the screen outside opened drawer - drawer closing. Using DrawerLayout.LOCK_MODE_LOCKED_OPEN is unsuitable bacause I need to save drawer sliding functions. How to prevent closing Navigation drawer when user touch outside the drawer? Please, help. Noundla Sandeep Based on the other answer which I

Android centre title with navigation drawer

冷暖自知 提交于 2019-11-29 13:58:26
问题 I currently have a navigation drawer with a toolbar that has a title, i wish to centre this title within the toolbar but the toolbar does not seem to take into consideration the drawer icon as you can see in the following picture. whereas when i use the same toolbar layout for other activities that are not inside the navigation drawer the title is centred perfectly, as show in this picture: So how do i get it to take into account this icon? Here is my layout: <android.support.design.widget

gridview and navigation drawer not working together in android

亡梦爱人 提交于 2019-11-29 12:43:07
I have downloaded code for gridview and code for navigation bar. Both codes are working fine individually but when I am trying to combine them its giving a runtime error "Unfortunately App Has Stopped". Below is my code : MainActivity.java public class MainActivity extends Activity { private DrawerLayout mDrawerLayout; private ListView mDrawerList; private ActionBarDrawerToggle mDrawerToggle; private CharSequence mDrawerTitle; private CharSequence mTitle; private String[] mPlanetTitles; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

Runtime DrawerLayout must be measured with MeasureSpec.EXACTLY excpetion

痴心易碎 提交于 2019-11-29 10:04:58
I'm following this tutorial from and I'm facing with a strange problem. It doesn't matter what's in my DrawerLayout , but if its layout_height or layout_width are set to anything other than hardcoded number, it throws this runtime exception. I've seeing plenty of reports of this error thrown when trying to render an output in the Graphical Layout tool, but couldn't find any on a runtime error. I have the latest support library, updated just now to version 21.0.2 I would like to avoid hardcoding my height and width if possible. The beginning of the file looks like this. This way, it crushes.