navigation-drawer

How to set shared checkable behavior across all groups in NavigationView?

被刻印的时光 ゝ 提交于 2019-11-28 19:43:39
问题 I've created two groups with unique ids (I need a divider) and they both have checkableBehavior set to single . This allows multiple items from different groups to be checked at once, and that's exactly what I'm trying to avoid. I'd like to have one item checked at maximum, across all groups. Since I haven't found any way to do this in XML, I tried to implement a simple logic in onNavigationItemSelected to uncheck the previous menu item: if (previousItem != null) previousItem.setChecked(false

Disable dark fading in Navigation Drawer

穿精又带淫゛_ 提交于 2019-11-28 19:33:29
问题 Is there a way to disable the dark fading effect for the background view in the Navigation Drawer View in Android? 回答1: You can use setScrimColor(int color) method. As default color is used 0x99000000 . So if you don't want faded background, set transparent color in this method. mDrawerLayout.setScrimColor(getResources().getColor(android.R.color.transparent)); 回答2: Addition to koso's answer: you can directly call the colors from Color class like this: mDrawerLayout.setScrimColor(Color

How to Add icons adjacent to titles for Android Navigation Drawer

别等时光非礼了梦想. 提交于 2019-11-28 18:50:30
I am currently working on an android app for 4.2.2 that uses the new NavigationDrawer. It works like a charm except for adding icons. I found some sample code in which the List view becomes a Relative layout in which 2 parallel arrays are nested and rendered by an Array Adapter based on a menu model a way that they are synchronized, I think. Here is the MainActivity: package com.sorin.medisynced.main; import android.app.Activity; import android.app.SearchManager; import android.content.Intent; import android.content.res.Configuration; import android.os.Bundle; import android.support.v4.app

Change the color of Navigation Drawer indicator icon

↘锁芯ラ 提交于 2019-11-28 18:26:21
问题 I am using a toolbar in place of actionbar and i am also using a navigation drawer.My toolbar colour is black and i want my navigation drawer indicator colour to be white.So how to change the colour of the navigation drawer indicator or put a custom navigation indicator in v7.Can any one please help me? 回答1: Try creating this style in your styles.xml . <style name="DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle"> <item name="color">@android:color/white</item> </style> And, then

How to open navigation drawer on button click in main fragment?

依然范特西╮ 提交于 2019-11-28 18:24:37
I have made an app with one activity which uses a navigation drawer to open a number of different fragments. I have the actionbar drawertoggle, but it is not very visible. If I place a button in the onCreateView in my main fragment(the fragment that appears when my app first starts up), how can I get it to open the navigation drawer controlled by my activity? This seems to work. The answer is much simpler than I thought it would be. @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View fragView = inflater.inflate(R.layout.mainmenu,

Android ripple background color

风格不统一 提交于 2019-11-28 18:11:29
I am using a ripple effect on my navigation drawer. I have set it like this and applied it to my ListView: <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_activated="true" android:drawable="@color/black_200" /> <item android:state_pressed="true" android:color="@color/black_200"> <ripple android:color="@color/black_400" /> </item> <item android:drawable="@color/white" /> </selector> I want the ripple background to remain the same like the normal activated state. Even when I define the color to be the same as the activated state, it gets darker and the

Navigation drawer and view pager in same activity

心已入冬 提交于 2019-11-28 17:55:27
I am trying to implement both navigation drawer and view pager in same activity. Navigation drawer works fine but the view pager is not working, also i am getting null pointer on right swipe when navigation drawer is opened (Null pointer at android. support. v4. widget. DrawerLayout. isContentView(DrawerLayout.java:840). I am attaching the main xml layout and code below. <android.support.v4.view.ViewPager android:id="@+id/viewpager" android:layout_width="fill_parent" android:layout_height="fill_parent" > </android.support.v4.view.ViewPager> <android.support.v4.widget.DrawerLayout xmlns:android

Navigation Drawer : add headers in listview

别来无恙 提交于 2019-11-28 17:19:09
I have created a project with the new navigation drawer Object. I would like to customize the layout of the menu, to add another object like TextView, ImageView ... And for begining, i would like to modify the default layout which is composed only with one listview, by adding 2 or 3 headers in the listview. Today, i have tried to use "addHeaderView" but i think it's possible to use this only for adding one header. How can i do to add header and really customize my layout menu? Because, from the developer API, it seems that only two childrens are permit under a "android.support.v4.widget

How to properly design/style a Android Navigation Drawer [closed]

自古美人都是妖i 提交于 2019-11-28 17:04:37
Im having trouble find any resources on how to properly design a standard Navigation Drawer . I've got the below XML and am looking for ways to Populate multiple listviews, change font of text in listview etc. Im trying to design similar to some of the following designs. Im looking to find documents, Guides, code, examples or some direction besides referencing me to the Design doc . Im looking for more actual code on how to properly adapt this new Android Design pattern not just idea's of how they could look. NavDrawer <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas

How to add title in Navigation drawer layout?

烈酒焚心 提交于 2019-11-28 16:19:40
问题 [UPDATE] I solve the problem by adding addHeaderView : protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mTitle = mDrawerTitle = getTitle(); mPlanetTitles = getResources().getStringArray(R.array.planets_array); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerList = (ListView) findViewById(R.id.left_drawer); LayoutInflater inflater = getLayoutInflater(); ViewGroup mTop = (ViewGroup)inflater