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
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();
}
}