I have tabs in an actionbar. On large screens the tabs are embed to the actionbar but on small screens the are not. I want to control the tabs manual so i can separate the tabs from the actionbar. I tried to set abs__action_bar_embed_tabs but that didn't work
<resources>
<bool name="abs__action_bar_embed_tabs">false</bool>
</resources>
in this file: ActionBarImpl.java
on
private void setHasEmbeddedTabs(boolean hasEmbeddedTabs)
change the value:
mHasEmbeddedTabs = hasEmbeddedTabs;
to:
mHasEmbeddedTabs = false;
I found a solution to separate the tabs in code.
But now I have a new problem. The tabs don't fill the tabbar completely. Actionbar tabs don't fill the tabbar
I know this is an old post, however I would like to add a solution using
action_bar_embed_tabs
for future readers.Create the below method (do take care of the imports),
Then call this like below,
If you want tabs to appear inside the action bar,
setHasEmbeddedTabs(actionBar, true);
If you want tabs to appear separate/ below the action bar,
setHasEmbeddedTabs(actionBar, false);
All credits to Cliff.
In ActionBarSherlock, abs__action_bar_embed_tabs is used to determine whether the Tabs should be embed in ActionBar, and the value is stored in two files.
This means Tabs will be embed only if the width of device is bigger than 480dp. I think such configuration has already satisfied your requirement.
If you want to control it all by yourself, you can just create your own values folder with any configuration qualifier you want, and override this bool value.
EDIT: OK, i tried. It cannot work. In fact, it only work under HONEYCOMB. Since before honeycomb sherlock action bar has it's own ActionBarImpl, so you can change this value. But in native implementation of ActionBar, this value is com.android.internal.R.bool.action_bar_embed_tabs and cannot be modified.
So.. although i do not approve reflection mechanism, but maybe it's the only way to achieve your target.
I'm very sorry for making you confused.