如何显示在下面操作栏标签 [英] How to display tabs below action bar
本文介绍了如何显示在下面操作栏标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我把卡在操作栏,这是工作的罚款。但是当我旋转设备就会出现在操作栏。有没有什么办法,始终显示在下面的动作条,标签如
I have placed tabs in action bar and it is working fine. but when i rotate device it will appear on the action bar. Is there any way to always display that tab below action bar like
推荐答案
用于以下功能,强制显示堆叠标签
Used the following function which force to show stacked tabs
private void forceStackedTabs(ActionBar ab)
{
try
{
if (ab instanceof ActionBarImpl)
{
// Pre-ICS
disableEmbeddedTabs(ab);
}
else if (ab instanceof ActionBarWrapper)
{
// ICS
try
{
Field abField = ab.getClass().getDeclaredField("mActionBar");
abField.setAccessible(true);
disableEmbeddedTabs(abField.get(ab));
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
private void disableEmbeddedTabs(Object ab)
{
try
{
Method setHasEmbeddedTabsMethod = ab.getClass().getDeclaredMethod("setHasEmbeddedTabs", boolean.class);
setHasEmbeddedTabsMethod.setAccessible(true);
setHasEmbeddedTabsMethod.invoke(ab, false);
}
catch (Exception e)
{
e.printStackTrace();
}
}
这篇关于如何显示在下面操作栏标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文