动作条转换的标签,列出的导航,如果没有房 [英] Actionbar convert tabs to list navigation if there is no room
问题描述
我有一个标志,标题2标签和搜索功能的动作条。 在手机上(3.5),一切工作正常。 该动作条有2行。标志的标题和搜索功能出现在第一线路和标签apear在第二行。
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.
在我的平板电脑(7)everyting显示在一行上,但标签将被转换为一个列表,当我点击搜索图标。
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.
如何拆分(夏洛特)动作条中的2条线在我7tabblet? 或者是有解决这个问题的另一种方式?
How can i split the (sherlock)actionbar in 2 lines on my 7" tabblet? Or is there an other way to solve this problem?
推荐答案
我找到了一个解决方案来分隔code中的标签。
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);
}
}
但现在我有一个新的问题。该标签不完全填充的TabBar。 动作条的标签不填的TabBar
But now I have a new problem. The tabs don't fill the tabbar completely. Actionbar tabs don't fill the tabbar
这篇关于动作条转换的标签,列出的导航,如果没有房的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!