ActionBar and onConfigurationChanged

516 views
Skip to first unread message

Alex Fu

unread,
Dec 7, 2011, 9:04:35 AM12/7/11
to ActionBarSherlock
In my application I'm having the Activity handle orientation changes
as opposed to letting Android re create the activity. As a result of
this, when I rotate from portrait to landscape the ActionBar tabs gets
combined with the ActionBar above it, but when I go back to portrait
from landscape, the ActionBar tabs remain inline with the ActionBar...
Is there anyway to get it to be separate? Here is the result of what
happens when I go from portrait -> landscape -> portrait...
http://i44.tinypic.com/sxy8mb.png

Mike Willbanks

unread,
Dec 7, 2011, 4:08:35 PM12/7/11
to actionba...@googlegroups.com
I have this same issue; I have not investigated too much into how I could implement it when handling the configuration myself.

Alex Fu

unread,
Dec 7, 2011, 4:15:03 PM12/7/11
to actionba...@googlegroups.com
I've tweaked my code a bit, cleaning it up etc... So I still have the basic problem.. When orientation changes, nothing changes (which is good for now) but I now need to figure out how to get the ActionBar tabs to collapse into the Action Bar when switched to Landscape from Portrait and vice versa. If someone has an idea as to how this can be done or point me and Mike in the correct direction, it would be greatly appreciated.


On Wed, Dec 7, 2011 at 4:08 PM, Mike Willbanks <pen...@gmail.com> wrote:
I have this same issue; I have not investigated too much into how I could implement it when handling the configuration myself.



--
Alex Fu

Jake Wharton

unread,
Dec 7, 2011, 4:19:24 PM12/7/11
to actionba...@googlegroups.com
There's no easy way to do this with ABS 3.x because it relies on separate layouts for the embedded and below tabs. ABS 4.0 does not exhibit this. Unfortunately there's neither an easy fix nor an expected release of an ABS 4.0 beta/release candidate at this time (though it shouldn't be far off, christmas-ish?).

The best solution I can offer at this time is to store any info you need to keep on rotation in the custom non-configuration instance and allow activity recreation.  https://github.com/JakeWharton/ActionBarSherlock/blob/master/library/src/android/support/v4/app/FragmentActivity.java#L972-988 

Sorry.

---
Jake Wharton
http://about.me/jakewharton

Alex Fu

unread,
Dec 7, 2011, 4:21:53 PM12/7/11
to actionba...@googlegroups.com
I guess, in my case, having the ActionBar tabs not collapsing is fine for now. Can't wait to ABS 4 though! Thanks Jake.
--
Alex Fu

Reply all
Reply to author
Forward
0 new messages