0

Home page should have navigation drawer Other page don't have navigation drawer

Show up caret -> like this

Home page view look like

see here for details

And the fragment view looks like this:

see here for details Navigation drawer menu items selection snapshot

Developing app with navigation drawer My home page having navigation drawer And i want to hide navigation drawer and show action bar home button setHomeAsUpEnabled = true instead of navigation drawer.

How can i achieve this logic onto my app?

Please let me know if any one know about this??

Arun K
  • 15
  • 4
  • instead of fragment use activity and use custom toolbar with it – Vivek Mishra Feb 16 '16 at 13:06
  • Possible duplicate of [Switching between Android Navigation Drawer image and Up caret when using fragments](http://stackoverflow.com/questions/17258020/switching-between-android-navigation-drawer-image-and-up-caret-when-using-fragme) – Shabbir Dhangot Feb 16 '16 at 13:13

3 Answers3

0

to enable the Home back button use the below code.

 getSupportActionBar().setDisplayHomeAsUpEnabled(true);
Maheshwar Ligade
  • 6,709
  • 4
  • 42
  • 59
  • I check with this one fragment working properly but Issue is the other fragments having navigation drawer menu And how to handle this for all fragmets? – Arun K Feb 16 '16 at 13:10
0

create custome toolbar by this:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:local="http://schemas.android.com/apk/res-auto"
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:minHeight="?attr/actionBarSize"
    android:background="@mipmap/top_bar_bg"
    local:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
    local:popupTheme="@style/ThemeOverlay.AppCompat.Light"
    />

put this in activity

private Toolbar toolbar;
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);            getSupportActionBar().setDisplayHomeAsUpEnabled(true);

put this in manifest

<activity
            android:name=".activity.RegisterActivity"
            android:label="@string/profile"
            android:parentActivityName=".activity.HomeActivity"
            >

replace your current activity with android:name and replace your parent activity with android:parentActivity

Parsania Hardik
  • 4,593
  • 1
  • 33
  • 33
0

use this in fragment onCreateView or onResume ((AppCompatActivity) getActivity()).getSupportActionBar().setHomeAsUpIndicator(null); that will hide hamburger and show de back button

Angel Ruiz
  • 31
  • 6