Android : Why Custom Action Bar And Action Bar Tabs Combine?
I have problem with the custom actionbar and actionbar tabs for android 4.0.when my application run in the 4.4(in nexus 7.0 tabs)it works fine,but the problem with 4.0 device.the c
Solution 1:
I had same issues with landscape mode and I found the solution here: http://andreimihu.com/blog/2013/10/17/android-always-embed-tabs-in-actionbar/
Basically, the writer wants the tab inside actionbar while you and I wants it outside. So, just change the method call to false (code from the above link, but a bit modified):
// This is where the magic happens!publicvoidforceTabs() {
try {
finalActionBaractionBar= getActionBar();
finalMethodsetHasEmbeddedTabsMethod= actionBar.getClass()
.getDeclaredMethod("setHasEmbeddedTabs", boolean.class);
setHasEmbeddedTabsMethod.setAccessible(true);
setHasEmbeddedTabsMethod.invoke(actionBar, false);
}
catch(final Exception e) {
// Handle issues as needed: log, warn user, fallback etc// This error is safe to ignore, standard tabs will appear.
}
}
Post a Comment for "Android : Why Custom Action Bar And Action Bar Tabs Combine?"