Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setDisplayHomeAsUpEnabled(true) goes nowhere #50

Closed
vishnuchd opened this issue Feb 28, 2015 · 5 comments
Closed

setDisplayHomeAsUpEnabled(true) goes nowhere #50

vishnuchd opened this issue Feb 28, 2015 · 5 comments
Assignees
Labels

Comments

@vishnuchd
Copy link

I've called setDisplayHomeAsUpEnabled(true) and the arrow is showing, but it goes no where.

How can I do this

thanks.

@vishnuchd vishnuchd reopened this Feb 28, 2015
@vishnuchd
Copy link
Author

I achieved the same by adding the following line in Manifest file

Please suggest me if there is another way to do so.

@vishnuchd vishnuchd reopened this Feb 28, 2015
@mikepenz
Copy link
Owner

@vishnudbimcs you mean the drawer toggle? the library itself provided basic drawer toggle functionality. you can also get the object back from the result.

This library handles the MaterialDrawer and just basic stuff around it. So for special cases with the Toolbar or the ActionBarToggler just implement it as you would if you create a normal application. ;)

@mikepenz mikepenz self-assigned this Feb 28, 2015
@gpulido
Copy link
Contributor

gpulido commented Mar 4, 2015

Hello
I have an activity A with the Drawer and inside it I inflate a fragment A.
The drawer has .withActionBarDrawerToggle(true) and I haven't set the getSupportActionBar().setDisplayHomeAsUpEnabled(true) on the activity
Then, inside the Activity A y replace the fragment A by the fragment B, and I want to show the "backbutton" instead of the drawer toggle, after inflating the fragment B I do:

result.getActionBarDrawerToggle().setDrawerIndicatorEnabled(false);
 getSupportActionBar().setDisplayHomeAsUpEnabled(true);

And the backbutton is showed, however if I press it, it doesn't do anything. I have also made the Activity Override the OnbackPressed:

 @Override
  public void onBackPressed() {
}

But it is never hit.
I also have added onOptionsItemselected, but again nothing happens.

So I tested more things.

  1. I removed the Drawer, and just use the
getSupportActionBar().setDisplayHomeAsUpEnabled(true);

Results: Back button on Fragment A and B and it works.

  1. Using the drawer, but NOT changing the result.getActionBarDrawerToggle().setDrawerIndicatorEnabled(false);
    when loading Fragment B
    Result: The Hamburguer icon on Fragment A and B

  2. Setting getSupportActionBar().setDisplayHomeAsUpEnabled(true); at the init of the Application,
    and result.getActionBarDrawerToggle().setDrawerIndicatorEnabled(false); when loading the Fragment B
    Result: hamburguer on Fragment A, nothing show on Fragment B

I don't know what is happening here...

@mikepenz
Copy link
Owner

mikepenz commented Mar 4, 2015

@gpulido please read the following regarding this behavior

#65

Thanks

@lexrobinson
Copy link

First you need to initialize the toolbar :

Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);

then call the back button from actionBar :

getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);

@OverRide
public boolean onSupportNavigateUp() {
onBackPressed();
return true;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants