I use Sherlock action bar in my application. I used "ifRoom|withText" feature in my menu. If I test my code in portrait mode, I can see only icon and if I rotate orientation to landscape, still I see only icon. On the other hand, if I run with landscape, I can see text and icon on portrait and landscape. This means that When the screen is rotated, action bar is not refreshed. How can I fix?
In menu, I have
android:showAsAction="ifRoom|withText"
Also I used this line in my manifest file to fixed
android:configChanges="keyboardHidden|orientation|screenSize"
but it didn't work. And I run my code android 2.3
Also I used fragment in my activity,
FragmentManager fm = getSupportFragmentManager();
ft = fm.beginTransaction();
mFragment1 = fm.findFragmentByTag("f1");
if (mFragment1 == null) {
mFragment1 = new MenuFragment();
ft.add(mFragment1, "f1");
}
ft.commit();
Handling configuration changes is not supported with ActionBarSherlock.
On pre-ICS, ActionBarSherlock is NOT part of the decor view like the native action bar and is therefore subject to the same restrictions as your content view. By handling configuration changes you are not allowing the library to adapt to the change and therefore will see incorrect display or certain parts.
The Android documentation discourages handling config changes as well. Avoid them at all costs, especially when using ActionBarSherlock.
On a related note, I'm still trying to work around this for future versions of the library but for now avoiding is recommended.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With