I have an actionbar with a logo, a title, 2 tabs and a search function.
On a phone (3.5") everything works fine.
The actionbar has 2 lines. The logo title and the search function appear on the first line and the tabs apear on the second line.
On my tablet (7") everyting is shown on a single line. But the tabs will be convert to a list when i click the search icon.
How can i split the (sherlock)actionbar in 2 lines on my 7" tabblet? Or is there an other way to solve this problem?
I found a solution to separate the tabs in code.
private void embeddedTabs(Object actionBar, Boolean embed_tabs) {
try {
if (actionBar instanceof ActionBarWrapper) {
//ICS and forward
try {
Field actionBarField = actionBar.getClass().getDeclaredField("mActionBar");
actionBarField.setAccessible(true);
actionBar = actionBarField.get(actionBar);
} catch (Exception e) {
Log.e("", "Error enabling embedded tabs", e);
}
}
Method setHasEmbeddedTabsMethod = actionBar.getClass().getDeclaredMethod("setHasEmbeddedTabs", boolean.class);
setHasEmbeddedTabsMethod.setAccessible(true);
setHasEmbeddedTabsMethod.invoke(actionBar, embed_tabs);
} catch (Exception e) {
Log.e("", "Error marking actionbar embedded", e);
}
}
But now I have a new problem. The tabs don't fill the tabbar completely. Actionbar tabs don't fill the tabbar