Reputation: 33146
I want something very simple (which IMHO ought to be the default anyway!):
[logo] [---------------expanded action view--------------] [other actionview]
Android by default does this:
[logo] [----stupid empty space----][collapsed action view] [other actionview]
Fine, I thought: let's just taken the MenuItem, and call "expandActionView()" in onCreateOptionsMenu.
Nope!
Android now does this:
[back symbol] [logo] [---------------expanded action view--------------] [other actionview]
But ...where did that back come from? Why is it a button? What is it doing?
Is this a bug in Android? Two bugs, even? I can't find any mention of this magic behaviour in the docs, and the bit where it deleted the actionview seems very, very wrong :(. Should calling "expandActionView()" really deleted the ActionBar configuration and replace with a new one?
Upvotes: 3
Views: 1053
Reputation: 33146
Seems to be as-designed, but the design is poor.
The "unavoidable" home button is because it's hard-coded to assume that every "expand" was triggered by the user hitting a collapsed view and asking it to expand (obviously this is often NOT the case if you're doing it programmatically). It does NOT appear to use the back-stack either, which is odd
The "disappaearing" view is because I had removed the icon from my actionview (it was supposed to be always-expanded), and when hitting the home button it de-expanded it.
Workaround:
NB: essentially this means re-implementing the whole of ActionView collapse/expand, with the following differences:
Upvotes: 2