Why Is The Up Button Present Without Setdisplayhomeasupenabled()?
According to Google's document, getActionBar().setDisplayHomeAsUpEnabled(true) is needed to show the up button. I created a bare-bone activity using the wizard in Eclipse and spec
Solution 1:
When you specify a parentActivityName
in your AndroidManifest
, Acitivty
will check for that and automatically enable the "up" affordance if it's present.
Solution 2:
I described all possible combinations below and their outcomes:
- You have both
android:parentActivityName=".MyActivity
and thisgetActionBar().setDisplayHomeAsUpEnabled(true);
- back button appears and it works; - You only have this
android:parentActivityName=".MyActivity
- back button appears and it works, the same as above; - You only have this
getActionBar().setDisplayHomeAsUpEnabled(true);
, - back button appears but clicking on it doesn't go anywhere; - You have set the parameter to false in this
getActionBar().setDisplayHomeAsUpEnabled(false);
, even though you have thisandroid:parentActivityName=".MyActivity
in the manifest, the back button doesn't show up.
That's how this works my friend.
Post a Comment for "Why Is The Up Button Present Without Setdisplayhomeasupenabled()?"