Giter Club home page Giter Club logo

android-material-drawer-template's People

Contributors

easycheese avatar kanytu avatar peavers avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

android-material-drawer-template's Issues

Theme settings / Button color

Thank you for saving me so much work :)
1 question and an Issue for which I will make a separate ticket.

Following question:
where do you set the theme? especially the button color?

RTL support

Hi there,

I'm a beginner at Android development. I can't seem to find an easy way to insert RTL support for the navigation drawer. I've inserted the option android:supportsRtl="true" in the manifest and tried this but the function no longer accepts integer. I'm not sure how to overcome this.

Will this feature be easy to implement?

Navigation Drawer launches duplicate activities

Your nav drawer actually calls selectItem(position) twice. Normally undetectable you can tell if your nav menu is setup to launch an activity. When selected, it starts two instances of the activity.

See my pull request for the simple fix.

Selecting Items does not register a click or throws NPE

I've been using your Material Drawer implementation even before it was a template. Recently I've been experiencing this bug where clicking on a row item triggers it as selected but it does not go to the specified fragment. If I keep selecting items it throws the error below. Note that this is also present in a newly created project with this template.

java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.ViewGroup$LayoutParams android.view.View.getLayoutParams()' on a null object reference
            at android.support.v7.widget.OrientationHelper$2.getDecoratedStart(OrientationHelper.java:316)
            at android.support.v7.widget.LinearLayoutManager.findOneVisibleChild(LinearLayoutManager.java:1633)
            at android.support.v7.widget.LinearLayoutManager.findFirstVisibleChildClosestToStart(LinearLayoutManager.java:1453)
            at android.support.v7.widget.LinearLayoutManager.computeScrollOffset(LinearLayoutManager.java:997)
            at android.support.v7.widget.LinearLayoutManager.computeVerticalScrollOffset(LinearLayoutManager.java:969)
            at android.support.v7.widget.RecyclerView.computeVerticalScrollOffset(RecyclerView.java:1175)
            at android.view.View.canScrollVertically(View.java:12758)
            at android.support.v4.view.ViewCompatICS.canScrollVertically(ViewCompatICS.java:35)
            at android.support.v4.view.ViewCompat$ICSViewCompatImpl.canScrollVertically(ViewCompat.java:940)
            at android.support.v4.view.ViewCompat.canScrollVertically(ViewCompat.java:1237)
            at android.support.v7.widget.RecyclerView$LayoutManager.onInitializeAccessibilityEvent(RecyclerView.java:6594)
            at android.support.v7.widget.RecyclerView$LayoutManager.onInitializeAccessibilityEvent(RecyclerView.java:6573)
            at android.support.v7.widget.LinearLayoutManager.onInitializeAccessibilityEvent(LinearLayoutManager.java:204)
            at android.support.v7.widget.RecyclerViewAccessibilityDelegate.onInitializeAccessibilityEvent(RecyclerViewAccessibilityDelegate.java:66)
            at android.support.v4.view.AccessibilityDelegateCompat$AccessibilityDelegateJellyBeanImpl$1.onInitializeAccessibilityEvent(AccessibilityDelegateCompat.java:228)
            at android.support.v4.view.AccessibilityDelegateCompatJellyBean$1.onInitializeAccessibilityEvent(AccessibilityDelegateCompatJellyBean.java:56)
            at android.view.View.onInitializeAccessibilityEvent(View.java:5422)
            at android.view.View.sendAccessibilityEventUncheckedInternal(View.java:5295)
            at android.view.View$AccessibilityDelegate.sendAccessibilityEventUnchecked(View.java:20786)
            at android.support.v4.view.AccessibilityDelegateCompatIcs.sendAccessibilityEventUnchecked(AccessibilityDelegateCompatIcs.java:117)
            at android.support.v4.view.AccessibilityDelegateCompat$AccessibilityDelegateIcsImpl.sendAccessibilityEventUnchecked(AccessibilityDelegateCompat.java:210)
            at android.support.v4.view.AccessibilityDelegateCompat.sendAccessibilityEventUnchecked(AccessibilityDelegateCompat.java:358)
            at android.support.v4.view.AccessibilityDelegateCompat$AccessibilityDelegateJellyBeanImpl$1.sendAccessibilityEventUnchecked(AccessibilityDelegateCompat.java:255)
            at android.support.v4.view.AccessibilityDelegateCompatJellyBean$1.sendAccessibilityEventUnchecked(AccessibilityDelegateCompatJellyBean.java:82)
            at android.view.View.sendAccessibilityEventUnchecked(View.java:5280)
            at android.view.ViewRootImpl$SendWindowContentChangedAccessibilityEvent.run(ViewRootImpl.java:6951)
            at android.view.ViewRootImpl$SendWindowContentChangedAccessibilityEvent.runOrPost(ViewRootImpl.java:6977)
            at android.view.ViewRootImpl.postSendWindowContentChangedCallback(ViewRootImpl.java:6138)
            at android.view.ViewRootImpl.notifySubtreeAccessibilityStateChanged(ViewRootImpl.java:6251)
            at android.view.ViewGroup.notifySubtreeAccessibilityStateChanged(ViewGroup.java:2788)
            at android.view.ViewGroup.notifySubtreeAccessibilityStateChanged(ViewGroup.java:2788)
            at android.view.ViewGroup.notifySubtreeAccessibilityStateChanged(ViewGroup.java:2788)
            at android.view.ViewGroup.notifySubtreeAccessibilityStateChanged(ViewGroup.java:2788)
            at android.view.ViewGroup.notifySubtreeAccessibilityStateChanged(ViewGroup.java:2788)
            at android.view.ViewGroup.notifySubtreeAccessibilityStateChanged(ViewGroup.java:2788)
            at android.view.ViewGroup.notifySubtreeAccessibilityStateChanged(ViewGroup.java:2788)
            at android.view.View.notifySubtreeAccessibilityStateChangedIfNeeded

Unresponsive Navigation Buttons on API 15, ICS

This issue is not specific to API 15, it is just most apparent. I'm hoping for a fix that allows me to use the latest libraries.

Issue Description

When user selects an item in the navigation drawer, the item is momentarily highlighted but is not actually navigated to.

video of issue happening

Platforms Affected

I've seen this on several versions of android including 5.1 to some degree. On these platforms, the issue wasn't so severe and it just seemed like I was missing the button more often then before.

I then tried it on an API 15 device (ViewSonic VSD220) and found that I couldn't click any item in the list.

On other platforms I've found it to be a less critical issue as I've said. Tested platforms include API 21, API 22, API 19, API 18, API 16

Work-Around

For my customers, I discovered a temporary work-around is to double-tap the item.

How to Recreate

Clone the android-material-drawer-template repository as is and run on an API 15 device.

Issue Since

d66cd0e

Fixes

The only fix I've found so far is to roll back the support library version in build.gradle but then you also need to roll back the targetSdkVersion too. However, this breaks calls to viewholder.getAdapterPosition() in NavigationDrawerAdapter. Note that I have ruled out the other changes in commit d66cd0e (As my project never used those) and the cause is definitely something in the support libraries.

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.poliveira.apps.materialtests"
        minSdkVersion 11
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:support-v4:21.0.3'
    //noinspection GradleDependency
    compile "com.android.support:appcompat-v7:21.0.3"
    compile 'com.android.support:recyclerview-v7:21.0.3'
}

onPrepareOptionsMenu question

Hi, may i ask you a question.
i was trying to call the onPrepareOptionsMenu in the NavigationDrawerFragment.
But i found that the code was not calling.

Besides, i try to call the onPrepareOptionsMenu in the main activity, it was called. but the menu is return null.
May i know which code i should use actually, because i saw you have using the
" getActivity().supportInvalidateOptionsMenu(); // calls onPrepareOptionsMenu() " in the fragment.
But i dont know which code will call when run the above code.
Thanks.

There is some lag for the first time when you select a option from navigation drawer

Test case :
step 1) Select a item in the navigation drawer (Navigation Drawer opens perfectly)
step 2) Open Navigation drawer and select another item in the list
step 3) Now Open the Navigation Drawer

In step the Navigation drawer stops a bit and opens , its not as smooth as in the step 1

Is this issues only for me or for every one ?

Whats the solution for the issue ?

Please forgive me if you are not having this issue...

Thank you for this example project!

I have heavily adapted your code. Even so, I stumbled across an issue that seems to occur when I rotate the device. I have 2 selected items until I click on an item, at which point only the new item I click is selected.

I have tracked this issue back to the use of mTouchedPosition in NavigationDrawerAdapter. Basically, my code is selecting position 0 due to mTouchedPosition defaulting to 0 when it has not been explicitly declared. It would appear that when the adapter is instantiated, the first position is both selected and touched by default. The exception to that is when a non-touch related event results in the selection of a different item, like restoring from savedInstanceState. For this reason, it is permanently touched until another touch is detected.

I solved this issue by simply declaring:
private int mTouchedPosition = -1;
instead of:
private int mTouchedPosition;
which was implying that position 0 was touched until another touch was detected.

Perhaps I've modified out something that has resulted in my exclusive problem, or perhaps its been a fleeting issue for you or others. In any case, if setting mTouchedPosition = -1 is a good idea, please consider doing so.

I trust your judgment.

ameron32

java.lang.IllegalStateException: Cannot call this method while RecyclerView is computing a layout or scrolling

I've seen this crash a few times while using the navigation drawer.

java.lang.IllegalStateException: Cannot call this method while RecyclerView is computing a layout or scrolling
        at android.support.v7.widget.RecyclerView.assertNotInLayoutOrScroll(RecyclerView.java:1462)
        at android.support.v7.widget.RecyclerView$RecyclerViewDataObserver.onItemRangeChanged(RecyclerView.java:3000)
        at android.support.v7.widget.RecyclerView$AdapterDataObservable.notifyItemRangeChanged(RecyclerView.java:7503)
        at android.support.v7.widget.RecyclerView$Adapter.notifyItemChanged(RecyclerView.java:4353)
        at com.company.busscan.navigation.NavigationDrawerAdapter.touchPosition(NavigationDrawerAdapter.java:97)
        at com.company.busscan.navigation.NavigationDrawerAdapter.access$000(NavigationDrawerAdapter.java:24)
        at com.company.busscan.navigation.NavigationDrawerAdapter$1.onTouch(NavigationDrawerAdapter.java:64)

Trace mentions this chunk of code from NavigationDrawerAdapter:

private void touchPosition(int position) {
    int lastPosition = mTouchedPosition;
    mTouchedPosition = position;
    if (lastPosition >= 0)
        notifyItemChanged(lastPosition);
    if (position >= 0)
        notifyItemChanged(position);
}

and the ACTION_CANCEL case here too:

    viewHolder.itemView.setOnTouchListener(
            new View.OnTouchListener() {
                @Override
                public boolean onTouch(View v, MotionEvent event) {

                    switch (event.getAction()) {
                        case MotionEvent.ACTION_DOWN:
                            touchPosition(i);
                            return false;
                        case MotionEvent.ACTION_CANCEL:
                            touchPosition(-1);
                            return false;
                        case MotionEvent.ACTION_MOVE:
                            return false;
                        case MotionEvent.ACTION_UP:
                            touchPosition(-1);
                            return false;
                    }
                    return true;
                }
            }
    );

Also, I'm curious whether I should expect any changes now that the support library revision 22 has added new recycler view methods getlayoutPosition() and getadapterPosition()

when the first menu is clicked, I want to startActivity

when the first menu is clicked, it becomes infinite loop. how can I fix this problem

@Override
public void onNavigationDrawerItemSelected(int position) {
        switch (position) {
            case 0: // giriş ekranını göster
                this.startActivity(new Intent(this, Arama.class));
                break;
            case 1: //detaylı arama
                this.startActivity(new Intent(this, DetayliArama.class));
                break;

...

Where would nav item selection logic go?

In this repo, when a navigation item is selected, the Main_activity just pops up a toast with that item's position, but I can't seem to figure out how to do more than that, things that actually affect the app's state.

Right now I'm looking to just change the Toolbar's title to the app title when the nav drawer is open, then to the title of the currently selected menu when it's closed (like Google Play Music),

I'm playing around with adding the code to onNavigationDrawerItemSelected (just for the second part of the problem), but get null pointers whenever I try to do something like getSupportActionBar().setTitle("Menu item" + position);

Then extending on that, I'd like to be able to swap out the container frame's fragment when an item is selected. So if I have fragment_one and fragment_two, where would I go to define the code that says 'load fragment_one into container on menu 1 tap'?

Perhaps a more complete example of an app that's using this template would really help.

Thanks!

wrong height for toolbar in landscape

If you try to rotate the device in landscape mode, you will notice that the app_title is not centered.

the solution is this:

in action_main.xml replaced with :

<include
    android:id="@+id/toolbar_actionbar"
    layout="@layout/toolbar_default"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize" />

and in toolbar_default.xml

<android.support.v7.widget.Toolbar 
    xmlns:android="http://schemas.android.com/apk/res/android"
    style="@style/ToolBarStyle"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:background="?attr/colorPrimary" />

missing constructor for NavigationDrawerFragment()

The NavigationDrawerFragment class is missing an empty constructor as required by the API
"All subclasses of Fragment must include a public no-argument constructor. The framework will often re-instantiate a fragment class when needed, in particular during state restore, and needs to be able to find this constructor to instantiate it. If the no-argument constructor is not available, a runtime exception will occur in some cases during state restore."
http://developer.android.com/reference/android/app/Fragment.html

I personally havent had any problems but rather safe than sorry.

Great work btw!

How do you change the selected NavigationDrawer Item Selected?

When you change orientation, the activity runs the onCreate again. It also creates/sets up the NavigationDrawerFragment.

So if we have previously selected the 2nd item in the list and change the configuration by changing orientation, the 2nd item will stay as selected. It will also show the relevant fragment for that item (when set up).

However if we change the fragment via a button, on one of the fragments within, and call onNavigationDraweItemSelected manually. The fragment shown will change but the selected item/position in the navigation drawer does not change.

Hence when you rotate, the visible fragment will be based on the selected item that has not changed.

So how can we change the selected item in the Navigation Drawer, from some other method.

Drawer somehow disables onClickListener?

Added a couple of activities to the drawer list, made them implement NavigationDrawerCallbacks and added the part at the xml file. The activities open just fine, the drawer is working as it should.

The only problem is that in both the activities I added, the button onClickListeners I had are not working. Everything is displayed properly but when I press the buttons nothing happens.

The listeners are working properly without the drawer.

Navigation RecyclerView items offset after full screen

First of all let me say thank you for this code. It works great!

In my app I have the need to set full screen using:

if (Global.prefFullScreen && Build.VERSION.SDK_INT >= 18) {
            mDecorView.setSystemUiVisibility(
                    View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                            | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
                            | View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
                            | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
            getSupportActionBar().hide();
        } else if (Global.prefFullScreen) {
            mDecorView.setSystemUiVisibility(
                    View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                            | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
                            | View.SYSTEM_UI_FLAG_FULLSCREEN);// hide status bar
            getSupportActionBar().hide();
        }

Everything works fine but when I exit full screen

mDecorView.setSystemUiVisibility(0);
        getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
        getSupportActionBar().show();

the navigation items have a little gap at the top and do not sit under the action bar as when it starts.

This is what it looks like when the app starts up and everything is OK
before full screen

and this is what it looks like after the full screen
after full screen

I cannot figure out where and when or what to change. Can you help me out?

Cheers,
Tim

I can't change fragment

I have compiled this library.
when i customised drawer layout and according to it when i am trying to change main container's fragment it throws error..

can you please give some example project? which shows container's fragment change as well as drawer's custom layout (gmail style header and then after list view)??

thank you in advance

Make Menu Icons Invisable when Navigation Drawer is open (Fragments of ViewPager)

Hello! First of all thank you for this great project!

I have some problems and I hope you know solution. I have MainActivity with ViewPager which had 3 Fragment. Each Fragment has there own menu items in toolbar. Inside of my MainActivity I added your beautiful Navigation drawer. I want to make menu icons in toolbar invisable when Navigation Drawer is open. (no matter what fragment open)

In your project you used it:
@OverRide
public boolean onCreateOptionsMenu(Menu menu) {
if (!mNavigationDrawerFragment.isDrawerOpen()) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return false;
}
return super.onCreateOptionsMenu(menu);
}

Unfortunatly I have 3 menu files for each fragment and I am little bit comfused how to set all of them here. I experemented but I have no results. How I can fix it?

My second question is about customization of Navigation Drawer. Inside of NavigationDrawerFragment we have Navigation items list but how to add dividers between items. I want to make something like sections inside of Navigation drawer. It is little bit problematically with that list.

Thank you again for project! Have a nice day! Gob bless you!

How to select menu position when using popBackStack?

Hi, newbie here.

Let say I have 3 menus (Menu 1, Menu 2, Menu 3)

Then in onNavigationDrawerItemSelected I use addToBackStack for each menu.

After run the app, I select the Menu 2, then I hit the back button, it will show Menu 1 but drawer still highlighting Menu 2.

How to change the drawer highlight?

I know by using selectPosition, but how to get the position?

Using ScrimInsetLayout to display navigation drawer behind toolbar

Is this possible? My code is as follows but it doesn't seem to work. The content is behind the status bar but I don't get the gray inset, just whatever color I set my status bar to i.e primarycolordark

activity_main.xml

<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"

android:fitsSystemWindows="true">

<!-- Your normal content view -->
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <!-- We use a Toolbar so that our drawer can be displayed
         in front of the action bar -->
    <include layout="@layout/toolbar"/>

    <!-- The rest of your content view -->
    <FrameLayout
        android:id="@+id/container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        />



</LinearLayout>

    <!-- The navigation drawer -->


        <fragment
            android:id="@+id/fragment_drawer"
            android:name="example"
            android:layout_width="@dimen/drawer_width"
            android:layout_height="match_parent"
            android:layout_gravity="left|start"
            />


</android.support.v4.widget.DrawerLayout> 

fragment_drawer.xml

<?xml version="1.0" encoding="utf-8"?>
<uk.co.example.utils.ScrimInsetsFrameLayout xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/scrimInsetsFrameLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:elevation="10dp"
    android:fitsSystemWindows="true"
    app:insetForeground="#4000">
<android.support.v7.widget.RecyclerView
    android:id="@+id/drawerList"
    android:layout_width="match_parent"
    android:clickable="true"
    android:focusableInTouchMode="true"
    android:scrollbars="vertical"
    android:focusable="true"
    android:layout_height="fill_parent"
    android:background="@color/nav_background"

    />
   </uk.co.example.utils.ScrimInsetsFrameLayout>

MainActivity onCreate method

@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_main);

        ButterKnife.inject(this);
        setSupportActionBar(mToolbar);

        mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
        mDrawerLayout.setStatusBarBackgroundColor(
                getResources().getColor(R.color.bayer_dark_green));

        mNavigationDrawerFragment = (NavigationDrawerFragment) getFragmentManager().findFragmentById(R.id.fragment_drawer);
        mNavigationDrawerFragment.setup(R.id.fragment_drawer, (DrawerLayout) findViewById(R.id.drawer_layout), mToolbar);
    }

styles-v21

<style name="AppTheme.21" parent="AppTheme">

        <item name="android:windowDrawsSystemBarBackgrounds">true</item>
        <item name="android:statusBarColor">@android:color/transparent</item>
    </style>

Drawer opens the included activities one by one.

Thanks for the last answer regarding the opened drawer. I added a second activity, included the drawerlayout and changed the first's onNavigationDrawerItemSelected method to this:

@OverRide
public void onNavigationDrawerItemSelected(int position) {
switch(position){
case 0:
Intent in = new Intent(getApplicationContext(),Activity1.class);
startActivity(in);
break;
case 1:
Intent in2 = new Intent(getApplicationContext(),Activity2.class);
startActivity(in2);
break;
}
}

The thing is that when i run the app, the drawer opens the main activity (activity1) again and again and it loops forever. I only want it to open when I press on it, not when it's selected (which by default is when you first run the app).

Any ideas?
Thanks in advance for my idiotic questions.

setHomeButtonEnabled dosn't work

How can I run?

code:
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);

Nav drawer icon problem in fragment replace

I was using replace the container with fragment.
I want when replace the fragment, the nav drawer icon from hamburger change to back arrow, when user on back press, the nav icon turn back to hamburger. Below is my code.

public void setActionBarArrowDependingOnFragmentsBackStack() {
    int backStackEntryCount = getActivity().getSupportFragmentManager().getBackStackEntryCount();
 if(backStackEntryCount >= 1) {
       ((ActionBarActivity)getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    }
   }

It should turn back to hamburger icon when the backstackentrycount less than 1. But it not able to turn back. Is that i miss out any code? Thanks a lot if you can help me.

Navigation drawer bottom item

I have successfully integrated material navigation drawer. My problem is i want to add bottom item in the navigation drawer. Can you guid me to achieve this. Thanks!

How to add callback on home button is pressed?

Try change home button with mNavigationDrawerFragment.showBackButton() for back to previous fragment but how to trigger on button is pressed and prevent open drawer? onOptionsItemSelected(MenuItem item) does not work.

Click on the item have no reaction

Click on the item have no reaction, to click many times to click, whether RecyclerView control of reason, can consider to the ListView

need help for use with fragment

sorry for question but i'm a noob in Android developpment, i try to follow my lesson when i have this :

       @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                 Bundle savedInstanceState) {
            View rootView = inflater.inflate(R.layout.fragment_main, container, false);
            Bundle args = getArguments();
            switch (args.getInt(ARG_SECTION_NUMBER)){
                case 1:
                    rootView = inflater.inflate(R.layout.fragment_edit, container, false);
                break;
                case 2:
                    rootView = inflater.inflate(R.layout.fragment_search, container, false);
                    break;
                case 3:
                    rootView = inflater.inflate(R.layout.fragment_quizz, container, false);
                    break;
            }
            return rootView;
        }

for change fragment when i click on basic drawer fragment, i try this with your code :

    @Override
    public void onNavigationDrawerItemSelected(int position) {
        LayoutInflater inflater = getLayoutInflater();
        View rootView = inflater.inflate(R.layout.fragment_main, findViewById(R.id.container), false);
        switch (position){
            case 1:
                rootView = inflater.inflate(R.layout.fragment_edit, container, false);
                break;
            case 2:
                rootView = inflater.inflate(R.layout.fragment_search, container, false);
                break;
            case 3:
                rootView = inflater.inflate(R.layout.fragment_quizz, container, false);
                break;
        }
        return rootView;
        // update the main content by replacing fragments
        Toast.makeText(this, "Menu item selected -> " + position, Toast.LENGTH_SHORT).show();
    }

but i don't know how i can have a Viewgroup for the inflater .

Thank you for the time you use to read me.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.