FAQ Database Discussion Community


How can I change the actionbardrawertoggle icon, android?

android,navigation-drawer,actionbardrawertoggle
In my activity I want to change the drawer toggle icon I have my toolbar <android.support.v7.widget.Toolbar android:id="@+id/tool_bar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="@color/appColor" android:minHeight="?attr/actionBarSize" app:theme="@style/MyDarkToolbarStyle"> </android.support.v7.widget.Toolbar> This is the toolbar theme <style name="MyDarkToolbarStyle" parent="Widget.AppCompat.Toolbar"> <item...

How to access navigation drawer in all activities?

android,android-intent,android-fragments,navigation-drawer
I am following this tutorial http://www.androidhive.info/2013/11/android-sliding-menu-using-navigation-drawer/ Now This is my fragment,and here I am able to see navigation drawer,Now from this fragment I Intent to next activity and I want to display navigation drawer in that activity public class WhatsHotFragment extends Fragment { public WhatsHotFragment(){} @Override public View onCreateView(LayoutInflater inflater,...

Navigation drawer icon arrow instead of three lines

android,icons,navigation-drawer
I have created a new project in eclipse with the navigation drawer and instead of the three lines icon on the top left of the screen I have the back arrow icon. I have found nothing on stack over flow which seems to help. I have tried to change the...

Custom Navigation Drawer : The ListView over the Toolbar

android,listview,layout,navigation-drawer
I have this MainActivity.xml and I would like when my ListView (Drawer Navigation) opens over the ToolBar. A change in my XML is enough to get a result ? If it's possible with ToolBar and style. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity" android:orientation="vertical" xmlns:app="http://schemas.android.com/apk/res-auto">...

Fragment not showing

android,android-fragments,navigation-drawer,android-fragmentactivity,android-navigation
So I've been basing my navigation drawer after code i found in a tutorial. However my fragments don't switch. Laptop is down and using AIDE. Anyone tell me what's wrong? Guessing it's my setonitemclicklistener. { private ListView mDrawerList; private DrawerLayout mDrawerLayout; private ArrayAdapter<String> mAdapter; private ActionBarDrawerToggle mDrawerToggle; private String mActivityTitle;...

How can I change separator color in NavigationView?

android,navigation-drawer,navigationview
I'm trying to use NavigationView to implement NavigationDrawer. I have added the separator by setting group id in menu. However I can't see the separator. I guess it is because the separator color is same as the background. So I want to change the separator color. But I find no...

drawer icon in Actionbar is show me a error when I click then

android,android-actionbar,navigation-drawer,slidingdrawer
Im using Android Studio 1.2 The icon drawer in actionbar is give me an error when I click then but is work fine If I open it sliding with the hand from the left to the rigth. this is my layout where I have my drawer list from the left;...

Android switch Fragments in the new design support navigation drawer

android,android-fragments,navigation-drawer,androiddesignsupport
how can I switch Fragments in the new design support navigation drawer? I found example codes on the Cheesesquare Github on how to switch fragments using the TabLayout, but not the navigation drawer. Is that the same? I also would not like to recreate fragments when switching, but rather do...

decrease the size of Material Navigation drawer-drawer

android,navigation-drawer,material-design
I'm using http://www.android4devs.com/2014/12/how-to-make-material-design-navigation-drawer.html So, how we can decrease size of this drawer? i mean this drawer size: to the Telegram example(exactly like this): ...

ActionBar Tab gets invisible quickly on start

android,android-fragments,navigation-drawer,android-actionbar-tabs
I am trying to implement ActionBar tabs in Navigation Drawer item fragment. But On starting the app, it gets invisible instantly Here is my MainActivity: public class MainActivity extends ActionBarActivity implements NavigationDrawerFragment.NavigationDrawerCallbacks { /** * Fragment managing the behaviors, interactions and presentation of the navigation drawer. */ private NavigationDrawerFragment mNavigationDrawerFragment;...

Navigation drawer listview position not refreshing

android,android-listview,navigation-drawer,baseadapter
I have one NavigationDrawer in my Application and I have five items in my drawer: Home Accounts stock help logout Now if user click on logout it is displaying two items: Home Login Now the issue is when user click on login it always getting view of Accounts public class...

Access fragment's view in DrawerItemClickListener (NavigationDrawer) - outside onCreateView()

android,android-fragments,navigation-drawer
I try to get the Fragment's View in the DrawerItemClickListener. But I can't access the right View! MapFragment: public class MapFragment extends Fragment { public View rootView; public MapFragment() { // Empty constructor required for fragment subclasses } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { rootView =...

Up Navigation in fragment

android-fragments,navigation-drawer,android-fragmentactivity,up-navigation
hi i am creating one android app in which i want to implement up navigation. i want to navigate to previous fragment through up navigation in actionbar. application also contain navigation drawer. i have implement following code but it does'n work. thanks in advance. main activity code as below. public...

Using a Navigation Drawer to Switch Activites?

android,android-activity,navigation-drawer
So, I have 3 activities that I want to link with a Navigation drawer but I'm exactly sure how to do that. I saw somewhere that I should make a new class for the Navigation Drawer methods or something like that but I didn't really understand. So, what would be...

ListFragment.onListItemClick() not being called; possibly due to Navigation Drawer

android,android-layout,android-listview,navigation-drawer,android-listfragment
I am perplexed as to why my onListItemClick() method is not being called. I was reading this question on the subject, and it mentions that any other components in the layout need to be set android:focusable="false" However, here is my layout for that class. As you can see, it has...

Using ViewPager and PagerTabStrip - extending FragmentActivity

android,android-fragments,android-viewpager,navigation-drawer,android-fragmentactivity
First - sorry for the newbish question. I've started building an app that has a single Activity and a navigation drawer. Each menu item loads a new fragment in the middle frame layout. I want to create another fragment that: has tabs allows for swipe scrolling It seems like the...

How to make navigation drawer toggle forcibly close all the time

android,navigation-drawer,android-toolbar,drawerlayout,actionbardrawertoggle
I am using DrawerToggle with toolbar in my project. I have a requirement to make drawer toggle in active (i.e it should not open or close on click or swipe). But I am completely struct how to achieve the things by making the toggle event standstill. I know that my...

Android - move navigation drawer titles away from main activity

android,navigation-drawer
I've been following this tutorial (http://codetheory.in/android-navigation-drawer/) to create a navigation drawer. I'd like to move the strings that populates the drawer outside the MainActivity, for instance to strings.xml Here is the code that populates the drawer mNavItems.add(new NavItem("String 1", "", R.mipmap.ic_action_home)); mNavItems.add(new NavItem("String 2", "", R.mipmap.ic_action_about)); mNavItems.add(new NavItem("String 3", "",...

Rendering problems, could not find android.support.v4.widget.Drawerlayout

android,xml,navigation-drawer
I have tried each and every solution from the SO, but my problem still isn't solved. Following is the error I am getting: The following classes could not be found: - android.support.v4.widget.DrawerLayout (Fix Build Path, Create Class) Tip: Try to build the project. I am just exporting this android project into...

How to provide navigation for an app that supports tablets and handsets

android,android-fragments,navigation-drawer,android-ui,landscape-portrait
I know this might been asked before but since I didn't find anything convincing, I need to ask again. How do you design an app that's going to support tablets and handsets when you also need to provide some sort navigation panel(e.g. Navigation Drawer)? I think I know how to...

Navigation Drawer multiple containers and best practice

android,android-layout,android-fragments,navigation-drawer,ui-patterns
I am relatively new in Android UI development. So I need some help from more experienced developers. I am creating my app with Navigation Drawer, I have faced with a lot of problems. Firstly, here is sample code for Navigation Drawer. <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...

TabHost displays content once (onCreate)

java,android,fragment,navigation-drawer,android-tabhost
I have a TabHost Inside a navigationDrawer and I'm facing this weird problem which occurs when ever i go from TabHost which exist as a navigation drawer item to another navigation drawer item and get back to TabHost it won't display its content, the first time it works perfectly but...

Returning to activity after onActivityResult?

android,textview,navigation-drawer,textwatcher
So, here's the scenario. There is one EditText which has its own TextWatcher set, used for setting the word count. I also have a Navigation Drawer, Sliding, and in that have an option which launches a new Activity for result. The result I want is the Target number of words...

Best way of implementing a scrolling navigation drawer

android,android-listview,scroll,navigation-drawer
I have been adding a navigation drawer to one of my apps, and I started to wonder whether or not it would be better to switch from using a ListView to multiple TextViews for the navigation drawer list items. Looking at the Google Design Guidelines on Navigation Drawer content (specifically...

Navigation Drawer Icon not visible with custom action bar?

android,navigation-drawer
I am trying to use navigation drawer with custom action bar. My action bar does not contain any menu. I see that the Navigation Drawer icon, is not visible on the action bar when the drawer is closed. Even though I have given the drawer icon in the ActionbarToggle implementation....

Android navigation drawer shadow on inside

android,navigation-drawer
Is there a quick way to render the shadow that the navigation drawer creates on the inside of the draw, rather than over the main content? Kinda to make it look like the drawer is under the main content, rather than over. I thought there might be an easy way...

Android how toggle with the button in toolbar to open/close navigation drawer with Fragments

java,android,fragment,navigation-drawer,toolbar
I am new in Android Development after reading so many tutorials and documentation and spending some time finally i managed to create a navigation drawer with the toolbar. but currently the problem is i can only open drawer by swiping from left side of the screen (not capable open/close drawer...

Android Drawer – Change Icon onClick

android,listview,onclick,icons,navigation-drawer
I have got a simple navigation drawer with a header (see picture). What I want to do now is whenever the header (listview-item with position 0) is clicked to either change the down-arrow-icon (bottom right corner of header) to an up-arrow-icon or to rotate it so the arrow points up....

Android ScrollView not scrolling in Activity with Drawer Layout

android,android-layout,navigation-drawer,android-scrollview,drawerlayout
Let me introduce you to my activity: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent"> <include android:id="@+id/toolbar_actionbar" layout="@layout/toolbar_default" android:layout_width="match_parent" android:layout_height="wrap_content"/> <FrameLayout android:id="@+id/main_fragment_container" android:layout_width="match_parent"...

Icon to Navigation Drawer

java,android,icons,navigation-drawer
I am trying to add icons to my Navigation Drawer in Android. I have the following code in my main public class MainActivity extends ActionBarActivity { private ListView mDrawerList; private DrawerLayout mDrawerLayout; private ArrayAdapter<String> mAdapter; private ActionBarDrawerToggle mDrawerToggle; private String mActivityTitle; private myAdapter MyAdapter; @Override protected void onCreate(Bundle savedInstanceState) {...

no more allow open Drawer layout from right side in navigation drawer

android,mobile,navigation-drawer,slidingmenu
I want to open drawer from right side, but when swite it works but when i click on toggle button in action bar it force close and give error that "No drawer view found with gravity LEFT" please help... I add layout like <ListView android:layout_gravity="right|end" android:id="@+id/left_drawer" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignParentTop="true" android:divider="#ccc"...

How to add DrawerLayout to my ToolBar / ActionBar

android,navigation-drawer,android-toolbar
I have a custom Toolbar that I've set up in my MainActivity to be the top action bar. The question is, how do you implement a NavigationDrawer to display when the ImageView in the toolbar is clicked? In MainActivity @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.layout_main_drawer); Toolbar mToolbar =...

handle back button in single fragment

android,android-fragments,navigation-drawer
I have an application with navigation drawer. when i start the application, what i have on main screen (screen A) is "hello world" and then when i select an item from navigation drawer, i load a fragment and get "new hello world" and then again when i select an item...

Android: NavigationDrawer vs. Tabbed Bar

android,android-tabhost,navigation-drawer
I'm developing an android app and i want to ask from a user-friendly perspective: Using NavigationDrawer or Using Tabbed View (TabHost i think) Which one is more user-friendly. Note: I'm not an android user....

Navigation Drawer in multiple activities does not work

android,android-layout,android-activity,navigation-drawer
I'm trying to use NavigationDrawer on my activity (Home), but the content of activity is not shown. home_activity.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:id="@+id/home_activity"> <Button android:id="@+id/like_count" android:layout_width="wrap_content" android:layout_height="wrap_content" android:onClick="likeCounter"...

Error in gradle: Design Navigation Library include

android,android-gradle,navigation-drawer,androiddesignsupport
I have trying to use the Design Navigation Library from Android so I have to modify my gradle adding ... compile 'com.android.support:design:22.2.0' compile 'com.android.support:support-v4:22.2.0' I have added them and this is my actual gradle: apply plugin: 'com.android.application' android { compileSdkVersion 22 buildToolsVersion "22.0.1" defaultConfig { applicationId "demo31.navigation" minSdkVersion 15 targetSdkVersion...

RecyclerView Navigation Drawer with separators

android-layout,android-studio,navigation-drawer,material-design,recyclerview
I have developed a Material Design based Navigation Drawer containing a Header View, following this tutorial: How To Make Material Design Navigation Drawer With Header View. I am trying to add a separator with a category name underneath it but there seem to be a problem with the position of...

fix java.lang.ClassCastException in android navigation drawer

android,navigation-drawer
I am creating an android application in android studio that consists of navigation drawer. I am getting an error called "java.lang.ClassCastException: m[email protected]41cdeb78 must implement OnFragmentInteractionListener at matrialdesign.practice.com.materialdesignpractice.navigatoin_drawer.onAttach(navigatoin_drawer.java:90)" Please help me to solve it i am new to android navigation drawer this is my main activity package matrialdesign.practice.com.materialdesignpractice; import...

Any way to add actionbar and listview in one single activity?

android,listview,android-listview,android-actionbar,navigation-drawer
When i open the activity the navigation drawer wont show up. So is there any way that i could add listview and actionbar together in one activity? Would appreciate if anyone could help me. Thanks public class Cart extends ListActivity { ArrayAdapter<String> mAdapter; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.cart);...

getFragmentManager on android.support.design.widget.NavigationView

android,navigation-drawer,android-support-library,android-design-library
On the new support design library I cant replace current fragment, check my code below. Although the Toasts are working and displaying on the screen. I'm getting empty screen whenever I'm going to click on any item on the navigation drawer private void setupDrawerContent(NavigationView navigationView) { navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() { @Override...

android.content.res.Resources$NotFoundException: String array resource ID #0x7f070002

android,arrays,navigation-drawer
I'm having problem getting a string array for strings.xml . The error is: android.content.res.Resources$NotFoundException: String array resource ID #0x7f070002 at android.content.res.Resources.getStringArray(Resources.java:472) at com.klh.lehava.MainActivity.onCreate(MainActivity.java:87) Basically what I'm trying to do is to get a string-array called planets_array, and store it into mPlanetTitles. This is one of google's examples for navigation drawer,...

Can't center Navigation Drawer items vertically

android,android-listview,navigation-drawer
Main activity layout (removed the irrelevant elements): <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/black" <RelativeLayout android:id="@+id/layout_relative_in_drawer" android:layout_width="match_parent" android:layout_height="match_parent"...

Android Navigation Drawer & Dialog

android,android-fragments,navigation-drawer,android-alertdialog,android-dialogfragment
is it possible to display an AlertDialog/DialogFragment and keep the Navigation Drawer open? I have tried an Alert Dialog and a dialog fragment, but the drawer closes abruptly. AlertDialog: new AlertDialog.Builder(this) .setTitle("Title") .setMessage("Message") .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { // ... } }) .setIcon(android.R.drawable.ic_dialog_alert)...

can I add an image header in navigation drawer layout

android,android-studio,header,navigation-drawer,expandablelistadapter
how can i add an image header to my navigation drawer layout like this one and this is my code : MainActivity.java package com.webileapps.navdrawer; import android.app.AlarmManager; import android.app.AlertDialog; import android.app.PendingIntent; import android.content.Context; import android.content.DialogInterface; import android.content.res.Configuration; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.support.v4.app.ActionBarDrawerToggle; import android.support.v4.app.Fragment; import...

Unable to see the Hamburger menu on Next screen

java,android,xml,android-studio,navigation-drawer
I am unable to find the hamburger menu in the next activity. It displays the action bar but not the hamburger menu. I am using the Android Studio IDE. MainActivity.java public class MainActivity extends ActionBarActivity { private DrawerLayout mDrawerLayout; private ListView mDrawerList; private ActionBarDrawerToggle mDrawerToggle; // nav drawer title private...

Setting a margin for NavigationDrawer items

android,navigation-drawer
My problem is that I can't correctly set up the margin in my navigation drawer. I have tried changing margin of any view and item but it doesn't seem to work out. All I get is space between the ActionBar and NavigationDrawer (and the beginning of the page). I think...

Navigation Drawer twitches on close

java,android,android-fragments,navigation-drawer
I try implement Navigation Drawer (Material Design) in my app. My activity contains FrameLayout with fragments. When user select item in Navigation Drawer FrameLayout reload new fragment: listViewDrawer.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick( AdapterView<?> parent, View view, int position, long id) { drawerLayout.closeDrawer( listViewDrawer); // <<<------- toolbar.setTitle( getResources().getString(...

NullPointerException navigationDrawer and tabs in android

android,tabs,navigation-drawer
I try to create navigationDrawer and tabs in android, but get this exception: 06-20 17:10:35.717: E/AndroidRuntime(17235): FATAL EXCEPTION: main 06-20 17:10:35.717: E/AndroidRuntime(17235): Process: com.dusandimitrijevic.spisakzakupovinu, PID: 17235 06-20 17:10:35.717: E/AndroidRuntime(17235): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.dusandimitrijevic.spisakzakupovinu/com.dusandimitrijevic.spisakzakupovinu.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void...

Drawer toggle not working as expected (icon remains the same)

android,navigation-drawer,drawertoggle,actionbardrawertoggle
I'm trying to implement an ActionBarDrawerToggle into my app but I can't make it. I've achieved to show the toggle in my toolbar, but the icon is the same always. This is toggle's icon when drawer is closed: http://i.stack.imgur.com/HTcom.png And this is when drawer is opened: http://i.stack.imgur.com/dX0Z2.png As you can...

Which drawer is being moved in Android?

android,navigation-drawer,drawerlayout
My project has two Navigation Drawers. One on the left using start and another on the right using end. As it is suggested here push activity on the right when open drawer I got my activity to move right whenever I am opening my drawer. But the problem is it...

The method setHomeAsUpIndicator is undefined for the type ActionBarDrawerToggle

android,android-actionbar,navigation-drawer,drawerlayout,actionbardrawertoggle
I'm trying to use the support v4 ActionBarDrawerToggle in order to change the action bar indicator to a back arrow instead of the navigation drawer's 3 dots. I'm also using the v4 Fragment, v4 Drawerlayout, v7 ActionBar and v7 ActionBarActivity. This is how I have used it: in onCreate: DrawerLayout...

ScrollView in Navigation Drawer

android,scrollview,navigation-drawer
I designed my Own custom navigation Drawer, and it looks like this: and the xml code for this navigation drawer is: <RelativeLayout android:id="@+id/UserOptionsDrawer" android:layout_width="240dp" android:layout_height="match_parent" android:layout_gravity="start" android:background="@color/nav_drawer_background_black" tools:layout="@layout/fragment_navigation_drawer"> <!-- Cover or Banner --> <RelativeLayout android:id="@+id/rlBanner" android:layout_width="match_parent" android:layout_height="150dp"...

Android design support navigation drawer huge actionbar

android,android-actionbar,navigation-drawer,androiddesignsupport
I am implementing the design support navigation drawer and I got it working, but the problem is the toolbar is now huge, it extends over the entire activity height. The code I am using: activity_main: <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/drawer_layout" android:layout_height="match_parent" android:layout_width="match_parent" android:fitsSystemWindows="true"> <include android:id="@+id/toolbar"...

Background image dimension for Navigation Drawer header

android,graphics,navigation-drawer,material-design
Basically I liked the background used by Mr. Jonathan Lee for Navigation Drawer header back ground in google official link http://www.google.com/design/spec/patterns/navigation-drawer.html#navigation-drawer-content So, I wanted to reproduce something similar inspired by that. I believe I need to make similar design in photoshop and set as background. But the question is, what...

Android: Starting a navigation drawer from an activity

android,android-layout,android-fragments,navigation-drawer
There are lots of question which are similar to mine but I couldn't find any solution in those answers. My program first shows a splash screen than comes to a log-in screen. After the user logs in I want to call the navigation drawer because my main screen and profile...

Android NavigationView menu group divider

android,navigation-drawer,android-design-library
Android support design library provide NavigationView: <android.support.design.widget.NavigationView ... app:menu="@menu/navigation_drawer_items" /> menu/navigation_drawer_items: <menu xmlns:android="http://schemas.android.com/apk/res/android"> <group android:checkableBehavior="single"> <item .../> ... </group> <group android:checkableBehavior="single"> <item .../> ... </group> </menu> How to add divider, separator or space between groups (like on picture)? ...

tabhost along with tabs goes when navigation drawer pulled

android,android-viewpager,android-tabhost,navigation-drawer
I have a navigation drawer with swipe views and tab navigation. My problem is that when navigation drawer is pulled tabs are gone and when i swipe project stops unexpectedly. Below is the logcat here is where studio points the error. mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) {...

Android Tabs inside sliding drawer

android,menu,tabs,navigation-drawer,slidingdrawer
I want to create a navigation drawer that contains tabs in android, but I could not do anything. I want to add tabs (categories, favorites) to the navigation drawer.Is it posible? (eg. ios) mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.ic_drawer, R.string.app_name, R.string.app_name ){ public void onDrawerClosed(View view)...

[Solved]Navigation drawer selected item textColor by Custom Adapter

android,android-arrayadapter,navigation-drawer,textcolor
May i know how to change the selected item's text color in navigation drawer. The android:textColor for listview is not working after install appcompat_v7 22.1.1 so i think i cannot change using selector drawable. I manage to change the default color of drawer items by using custom adapter. But this...

Handling OnItemTouch For a Navigation Drawer

android,navigation-drawer
I'm trying to add OnItemTouch in this tutorial: http://www.android4devs.com/2015/01/recycler-view-handling-onitemtouch-for.html final code: public class MyAdapter extends RecyclerView.Adapter<MyAdapter.ViewHolder> { private static final int TYPE_HEADER = 0; // Declaring Variable to Understand which View is being worked on // IF the viaew under inflation and population is header or Item private static final...

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

android,navigation-drawer,android-support-library,material-design,navigationview
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...

Open child fragment from NavigationDrawer Section

android,fragment,navigation-drawer
i'm trying to open child fragment from an fragment of Navigation Drawer. Look at the picture below for understand me better please. CODE: FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction(); fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); fragmentTransaction.replace(R.id.fragment_container, new ChatFragment(), MainActivity.CHAT_FRAGMENT_TAG); fragmentTransaction.addToBackStack(null); fragmentTransaction.commit(); ERROR DEBUG: java.lang.IllegalArgumentException: No view found...

Notification Bar is grey after implementing Nav Drawer

android,navigation-drawer,android-notification-bar
I am trying to learn implementations of Navigation Drawer in Android. In one activity, i have made the Navigation Drawer come under the Status Bar(transparent) and over the App Bar and everything works fine.(left Screenshot) In another activity in the same App, i am trying to create Navigation Drawer that...

NavigationView menu items with counter on the right

android,navigation-drawer,material-design,androiddesignsupport,navigationview
The new NavigationView in the new Design Support Library works really great. They uses "menu-items" to display the options. But how can I achieve to display a count to the right of the menu item? Like in this picture: Or like in the GMail app....

Get Toolbar's navigation icon view referrence

android,android-actionbar,navigation-drawer,toolbar,hamburger-menu
I would like to highlight drawer icon in my Toolbar (working on a tutorial). For that, I need its position. How do I get a reference to drawer's navigation icon (hamburger) view?

Intent not working in NavigationDrawerFragment

android,android-intent,navigation-drawer
I'm trying to call another activity using my NavigationDrawerFragment. Under my onOptionsItemSelected I create an intent and call the said intent but for some reason it is showing up as an error. Intent intent = new Intent(this, HomeActivity.class); I was wondering why it was not working since : I already...

Nav Drawer Home Button does not open drawer after opening another activity and going back

android,navigation,navigation-drawer
I have a particular situation where, I have a parent Activity which extends ActionBarActivity in that Activity I declare and initialize my DrawerLayout with all the boiler plate code for implementing a Navigation Drawer Then to save time I created new Activities which extend this DrawerActivity in my code so...

Android Navigation Drawer vertical border

android,android-layout,navigation-drawer
I want to make my NavigationDrawer just like in this app and more specifically, I want to add that little 1 pixel border on the right side but here is what I am getting with my drawer and this is the xml of the drawer fragment <ListView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"...

How do I update unread notification counter in the Navigation Drawer?

android,notifications,navigation-drawer
I am currently working on app which will have a notification drawer with 2 sections - A dashboard of status requests (pending, submitted, in process, completed). I have named it DashboardFragment.java A notification center which shows all messages received from the 3rd party Java server(via Google Cloud Messaging server). I...

Two Navigation Drawer on same Activity

android,navigation-drawer
Is it possible to configurate two Navigation Drawers on the same activity, one from the left and the other from the right?

Android navigation drawer won't open

android,navigation-drawer
I've checked other similar posts and can't find a solution. I have had trouble with a null pointer upon calling getActionBar(), I seemed to have solved that by using getSupportActionBar(). My app now runs but my nav drawer does not open. Here is my base activity, all other activities extend...

Android: how to get a MediaPlayer object from the MainActivity in a Fragment?

java,android,audio,android-fragments,navigation-drawer
I'm developing an android app and i'm using NavigationDrawer, there is only one activity (MainActivity) and Fragments. I have a radio live stream button on the ActionBar so i made an object of MediaPlayer in the MainActivity for the live stream button and it's working fine, now i have some...

NavigationView onClick from xml causes errors

android,navigation-drawer,android-resources,android-design-library,navigationview
Using NavigationView from the newly released Android support design library, if a navigation header layout includes an onClick (in the xml), onClick event crashes app. OnClick can be added programmatically via view.onClickListener (instead of xml), and then clicking works fine. But for some reason, whenever xml onClick is used, there...

onBackPressed closing app in fragments using NavigationDrawer

android,android-fragments,android-activity,navigation-drawer
I'm using NavigationDrawer with some fragments, the problem is when I'm in a fragment and hit the back button, it makes the app close, then I have to open it again, put my username and password all over again to use the app, how can I prevent that from happen?...

Navigation drawer on lollipop is empty after adding Toolbar

android,navigation-drawer,android-toolbar
I had a navigation drawer working a while back, but then I decided to update it to use a Toolbar instead of the default support action bar. Now, I have a situation where when I click the hamburger menu, the navigation drawer doesn't open. However, I can slide from left...

Change ListView element selection of a NavigationDrawer

android,listview,navigation-drawer
I have an app with a NavigationDrawer. I'm loading a Fragment from a Fragment(throught a onClick event of a button), but I can't find how to change the the item selection of the ListView of the NavigationDrawer corresponding to the Fragment. I tryed to do: final View navigationView = inflater.inflate(R.layout.fragment_navigation_drawer,container,false);...

Change Navigation Drawer text color

android,navigation-drawer
I am new to creating Android apps. I've made a new application with a Navigation Drawer (from the basic Android Studio Template) But i don't know how to edit my Navigation Drawer text color. Can someone help me with it? Here is my code in Activity_Main.xml <!-- As the main...

How to extend Activity in main class that extends “Fragment”?

java,android,android-fragments,switch-statement,navigation-drawer
I have an Android project and I use Navigation Drawer in it, and in the MainActivity, I have a switch-case, with options and your respective positions for to open when the user clicks. But, in a class called TelaQUEMSOMOS, the parameters that are there: public class TelaQUEMSOMOS extends Fragment {...

No view found for id 0x7f090058 for fragment

java,android,android-fragments,navigation-drawer
I'm doing an app that uses Google Maps APIs (with two separate maps), and I want to use a navigation drawer to switch between the two maps (fragments). I created the main activity with the pre-compiled Navigation Drawer Activity in android studio, and here is the pieces of code: The...

Get continuous iBeacons info with Android AltBeacon Library

android,navigation-drawer,ibeacon-android,altbeacon
I am developing an Android app using AltBeacon Library from RadiusNetworks. I am using a nav-drawer (which launches activities, not fragments) to show different sections. Thus I have one main activity for the drawer which launches different activities by means of intents. I would like to have nearby iBeacons info...

Unwanted animation of the NavDrawer when getting back to previous Activity

android,performance,navigation,navigation-drawer
I have a Navigation Drawer that launches activities when items are selected. Here's the problem: when I press back from an Activity, i get back to the previous Activity, but unfortunately i see an animation of the Navigation Drawer closing. This is an unwanted behaviour: i want to get back...

Customising NavigationView - Adding dynamic headerView, Android Support Design Library

android,navigation-drawer,android-design-library,androiddesignsupport,navigationview
I tried the navigationView from the new android support design library. I want to have a dynamic headerview. Basically, my headerview will show something like quote of the day. I have like around 10 quotes and i want to randomly select a quote and display in a textview in the...

ViewPager in DrawerLayout

android,android-viewpager,navigation-drawer
I put a ViewPager in a DrawerLayout. Now when I try to scroll ViewPager, menu is closed please tell me how to make the menu does not close when I scroll viewPager viewPager adapter: public class MenuNewsAdapter extends PagerAdapter { ArrayList<News> news = new ArrayList<>(); Context context; public MenuNewsAdapter(Context context,...

Android Toolbar for API 19? (for API 21 works ok)

android,android-actionbar,navigation-drawer,toolbar
I used How do I use DrawerLayout to display over the ActionBar/Toolbar and under the status bar? answer of Suyash (I added also toolbar, maybe wrongly) to put Navigation Drawer over the "action bar". For API level 21 instead of "action bar" I used toolbar, and it works fine. But...

Ripple effect on custom navigation drawer

android,navigation-drawer,material-design
I'm developing my first app providing to it the new material look. I'm a bit lost with this so I'm following some tutorials to implement things like Toolbar, Navigation Drawer, etc. I have to say that I'm doing it providing compatibility to pre-lollipop android versions, so I'm using support libraries....

Android Design Support Library Secondary Drawer Menu

android,navigation-drawer,android-support-library,android-design-library,androiddesignsupport
I've switched to the official Google Design Support Library. Now, I want to use a secondary menu with a divider like this: But as Android is using the Menu Inflater I have no idea what to do now. I can add a second group, but then the items have the...

BaseActivity to implement Navigation Drawer and Toolbar in every activity

android,tabs,navigation-drawer,toolbar
I created a base activity and base layout to extend those to get same nav drawer and toolbar in all my activities. However, I want to add sliding tab layout in one of my activity. Should I create a new layout for this? Or is there a way I can...

Why does Activity's method onCreateOptionMenu() get called two times by using setHasOptionMenu(true) for it's Fragments?

android,android-activity,fragment,navigation-drawer,oncreateoptionsmenu
I manage some Fragment's in my own ActionBarActivity named MainActivity. One Fragment is shown at one time. The example should be simple. The Fragment which is showing should have got an option menu under certain conditions. Here my code: public class MainActivity extends ActionBarActivity{ ... @Override public boolean onCreateOptionsMenu(Menu menu)...

Setting CustomAdapter for NavigationDrawer

android,navigation-drawer,custom-adapter
I have integrated Navigation drawer in my app.The issue is that CustomAdapter is not showing the content.However if i use default ArrayAdapter content is shown.I failed to understand where am I going wrong in setting CustomAdapter.

Drawer Layout on top of action bar?

android,navigation-drawer
I have created the navigation drawer just as explained by the google Creating a Navigation Drawer How can I make it overlap the action bar just like the google play store or gmail android apps. Any idea about that? protected void onCreate(Bundle savedInstanceState) { this.requestWindowFeature(Window.FEATURE_NO_TITLE); super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); mDrawerLayout...

NavigationDrawer does not move right to left

android,android-fragments,navigation-drawer
Here is my code: MainActivity package com.pa.homeautomationblank; import android.app.Activity; import android.app.Fragment; import android.content.res.Configuration; import android.os.Bundle; import android.support.v4.app.ActionBarDrawerToggle; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.view.Gravity; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import...

Background not displayed for the Navigation drawer

android,navigation-drawer
I have implemented a navigation drawer, thanks to the sample available with the sdk. I changed the navigation drawer background to an image of mine. It works well on my phone (Samsung Ace 3 Android 4.2.2), on a nexus 4 with lollipop. But on a friend's phone (HTC Sense, with...

How to make drawer just slide close instead of creating the activity again?

android,navigation-drawer,drawerlayout
I have an application where onItemClick() activity determines which item in the drawer is clicked and the corresponding activity is started. However, when if I am already at the 'Settings' screen and I open the drawer and click on 'Settings' again, it starts a new settings activity. How can I...

Android ripple background color

android,android-activity,android-listview,navigation-drawer,rippledrawable
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...

Set up side drawer controller

ios,objective-c,navigation-drawer,uistoryboard
basically i use MMDrawerviewController for side drawer and my setup for storyboard prototype is like below and my code is as successful login is UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; MenuVC *menuViewController = [storyboard instantiateViewControllerWithIdentifier:@"MenuVC"]; UIViewController *centerViewController = [storyboard instantiateViewControllerWithIdentifier:@"VC1"]; MMDrawerController *drawer = [[MMDrawerController alloc] initWithCenterViewController:centerViewController...

navigation drawer does not show main layout when app start

android,navigation-drawer
My navigation drawer works perfect but every time I run the program the drawer is opened by default instead of the main layout. The navigation drawer should be only opened when clicked on the drawer button. public class MainActivity extends Activity { private DrawerLayout mDrawerLayout; private ListView mDrawerList; private ActionBarDrawerToggle...

Clicking hamburger icon on Toolbar does not open Navigation Drawer

android,navigation-drawer,android-toolbar
I have a simple android.support.v7.widget.Toolbar and all I am trying to do is to open a NavigationDrawer by pressing the "hamburger" icon in the top left corner. The "hamburger" button is visible, and when I start to pull from the left I see the animation on the button but pressing...

How to create a simple divider in the new NavigationView?

android,navigation-drawer,android-support-library,android-design-library,navigationview
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,...

Android Navigation Drawer: How to change the click area while using a custom layout?

android,navigation-drawer
I have successfully created my Navigation Drawer and it displays properly. However my issue is that clicking the items don't work like Id like them to. My problem is that in-order to perform the click event you have to click in the red area where as I want the user...

Android: do i need to setup Drawer “burger icon” onClickListener?

android,android-actionbar,navigation-drawer
Im trying to setup an activity with a drawer and a toolbar/action bar, but im having some problems with the setup. My main_activity.xml: <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/DrawerLayout" android:layout_width="match_parent" android:layout_height="match_parent" android:elevation="7dp”> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent"> <include android:id="@+id/main_tool_bar"...