navigation-drawer

Navigation Drawer with Headers/Sections

拥有回忆 提交于 2019-12-03 06:10:41
问题 I would like to know if there is any way that I can add headers/sections to the navigation drawer. I managed to add something like that, but it is only displayed at the top of the list, because addHeaderView needs to be called before setAdapter and if I try to add more elements after setAdapter they will rewrite the first elements. Thanks. Edit: public class MenuListAdapter extends BaseAdapter { // Declare Variables Context context; String[] mTitle; String[] mSubTitle; int[] mIcon;

Android Studio navigation drawer like Gmail app

让人想犯罪 __ 提交于 2019-12-03 06:05:02
问题 We're making an android app, and there is something we want to add. Which is the effect the Gmail app has. You can choose which account you want to view (and the rest of the app will behave accordingly). EDIT: I now already have a (working) navigation bar, but the things I want are the round icons in the header. I want someone to be able to choose the user they are viewing. 回答1: The effect you want can be achieved by using NavigationView from the com.android.support:design support lib. You

Android set navigation drawer list to open exact half of the screen for all device screen

孤街醉人 提交于 2019-12-03 05:38:41
问题 I want to open the drawerlist to the half of the screen for all different device. i tried hard coded values for layout_margineleft 200dp or 100dp to the drawerlist. but it doesn't work in all device it different from device to device. so how can i maintain the exactly half of the screen for drawerlist. i also tried various function like setLeft(int) etc.but some of them doesn't work due to i use minimum version 8. So please help me. thanks in advance. mDrawerLayout = (DrawerLayout) view

Android Change Navigation Drawer Menu Items Text programmatically

自古美人都是妖i 提交于 2019-12-03 04:14:00
问题 I have the new Navigation Drawer in my app and I want to change the navigation view menu items title text dynamically from code. I have watched many posts but I can't figure out, how can I do this. How can I achieve this correctly? MainActivity.java @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); FloatingActionButton

Navigation drawer - Disable click through on items behind the drawer

风格不统一 提交于 2019-12-03 04:09:44
Is there any way to make sure that the navigation drawer stays on top of the content in the fragment? I created a small test application with dummy data. 10 fragments with a corresponding numbered button and textview. The issue is with the fact that the fragment elements seem to have higher priority than the navigation drawer. As seen in the screenshot, once I attempt to open up the "0 fragment" it instead opts to register the click on the button behind the navigation drawer. Pressing any other content item works fine, but this is as long as there are no other interactable items beneath them.

Add badge counter to hamburger navigation menu icon in Android

喜你入骨 提交于 2019-12-03 03:13:32
问题 My question is the same as this question (which is not a duplicate of this question). The only answer to that question does not work for me as, rather than changing the default hamburger icon to the left of the activity's title, it just adds an additional hamburger icon to the right of my activity's title. So how do I actually get this: I've been poking around at it all day, but have got nowhere. I see that Toolbar has a setNavigationIcon(Drawable drawable) method. Ideally, I would like to

Drawer like Google material design for iOS

守給你的承諾、 提交于 2019-12-03 02:58:02
I'd like to implement navigation drawer like Uber into iOS(swift). I'm going to achieve it by using a library, called KYDrawerController. https://github.com/ykyouhei/KYDrawerController However, it cannot provide toggle button, only slide action. Thought I'd like to to implement toggle button that shows the navigation drawer,I have no idea how to add such a function to the library. If you know how to add the function to the library, or how to achieve my purpose the other way(such as to use the other libraries), please tell me. Thank you for your kindness. Kyouhei Yamaguchi Using

Change color of Navigation Drawer Icon in Android Studio default template

久未见 提交于 2019-12-03 02:57:35
问题 The new default Navigation Drawer Activity template in Android Studio defines its titles and icons in a menu file activity_main_drawer like this: <group android:checkableBehavior="single"> <item android:id="@+id/nav_camara" android:icon="@drawable/ic_action_emo_cool" android:title="Import" /> <item android:id="@+id/nav_gallery" android:icon="@android:drawable/ic_menu_gallery" android:title="Gallery" /> <item android:id="@+id/nav_slideshow" android:icon="@android:drawable/ic_menu_slideshow"

Replace toolbar layout according to the displayed fragment

折月煮酒 提交于 2019-12-03 02:46:34
问题 I have an activity with navigation drawer which replace the main_fragment_container on the activity. When one of the fragments is displayed I want to change the layout of the toolbar and add a spinner to it (and remove it when the fragment is hidden). My layout looks like that: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:sothree="http://schemas.android.com/apk/res-auto" android:id="@+id/main_parent_view" android

Android: How to get Google+ Profile Image and Cover Photo into Navigation Drawer

孤者浪人 提交于 2019-12-03 02:29:17
问题 Assuming the user is logged into their Google+ account on the phone, How can one get the Google+ Image (circular) and the Google+ Cover Photo into the Navigation Drawer of an Android app? Is there an API for this? Also, how can we display the profile photo as a circle? I am trying to achieve the same navigation drawer UI as the Android INBOX app. 回答1: You will need Enabling G+ API on google console. https://developers.google.com/+/mobile/android/getting-started#step_1_enable_the_google_api