Description & Problem:
I'm using ActionBarSherlock i found that they are a bug in ABS, so my issue that i need to put tab bar at top bar (one line, like shown on the screenshot) already tried this solution but without effect.
I note that i don't have this problem on tablet. The problem is on 5.4° devcie Note III.
This is the normal behavior. On Large screen (tablet) or on landscape phone screen, Tab bar is included to top bar, and on small screen Tab bar is below top bar.
Try to add a SlidingTabLayout as a custom ActionBar view
Related
I tried Android action bar with tabs. As you see in this picture:
(source: persiangig.com)
My action bar looks good in phones but in tablets it is not right, the tabs stick left. This picture shows what I mean, how can I put the tabs to center in tablets too?
(source: persiangig.com)
The tabs are aligned left because, in Android, the action bar is used for both navigation and Activity- or Fragment-specific actions. You don't have any in this screenshot, but menu actions that are added to the action bar will be aligned to the right.
If you must have your tabs centered for some reason, you'll have to write your own action bar. I would recommend against this, since it's a lot of work to intentionally go against user expectations. Instead, use Android's built-in action bar layout and design your app to accommodate it.
I want to display Tabs below Android Action Bar in Landscape mode
I have set
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
I tried android:uiOptions="splitActionBarWhenNarrow" in Android manifest but everything seems to be OK in Portrait. But when view changes to Landscape, the tabs get embedded inside action bar.
Anyone has implemented this, because this does not seem to work.
OS - ICS and above.
This is correct behaviour. It's Split-Action-Bar-When-Narrow option and there are no options how to determine which actions will be displayed at top and which at bottom. ActionBar element is doing this according to screen orientation and screen resolution. Use your own toolbar.
I'm using ActionBarSherlock to manage my app's action bar. I've added 2 tabs which are linked to Fragments. No problem.
On a phone - in portrait, the tabs layout beneath the main action bar (as expected) and are equally spaced. Looks great. However, on a tablet - in portrait mode - the tabs layout beneath the main action bar, but are awkwardly centered:
I'd like to know how to fix this 2 ways:
How can I make the tabs align to the Left side of the parent activity and stay below the main action bar. I've seen a few apps do this.
[stop-gap] How can I space the 2 items out to fill the entire width?
Note: I mostly want to know how to implement version 1.
My problem is quite simple, however not sure if there is a clean/easy fix for this. I have an action bar with one tab. In some devices (motorola xoom) the tab is in the action bar, however in some other devices (Nexus 7, Samsung Galaxy 10 tablet), the stacked action bar shows up with the tab on it.
You can see from the picture below that the tab's text is small enough to for the tab to fit in the main action bar instead of spawning the stacked one... I am using a regular action bar, but I've read through the internet that this also happens in Sherlock.
Is there any way to fix this without having to recur to a customView? I wouldn't really want to change all my implementation (tab listeners, etc), just to do this. Thanks in advance!
I am building an app that uses ActionBarSherlock. I need to change it's layout so there is no padding arround tab icons. Now it looks like that:
| tab1 | tab2 | tab3 | t
But i want it like that:
|tab1|tab2|tab3|tab4|
I've manage to do so on normal size screens by changing that file:
library/res/values/abs__styles.xml
However on my Galaxy S3 still has padding, I tried changing paddings from:
library/res/values-xlarge/abs__dimens.xml
but no effect. I also tried to remove it but still no changes.
edit:
Just for information, I am using only icons but no text for top. All my icons are in drawable-hdpi, could that be a problem? I don't think so because they are not reseized or anything only paddings apper :S
that one is in values.
so I also tried comment out all lines with
<dimen name="abs__action_bar_icon_vertical_padding">0dip</dimen>
but no effect…
If your Galaxy S3 is running ICS or later, ABS will use the native action bar. Any changes you make to the library will have no effect.
Action Bar Sherlock library has some limitations in it.
Limitation 1 : Adjusting of Action menu items in action bar is not possible
Description :
You can have different action menu items in the action bar and also you can set the icons for that items in the action bar. But, adjusting padding between action items, Removing Toast for the action items in the action bar it is impossible. Because Action bar Sherlock uses native action bar. Only look and feel is similar to ICS, but behavior is restricted.
Limitation 2 : Activity Recreation
Description :
When Screen orientation changes, It will recreate activity which is in active. So User Interface will get updated and also it doesn't save the state of the application or activity..
Be Aware of Action Bar Sherlock
I wouldn't use ABS directly for Tab navigation. Consider using a Viewpager and ViewPagerIndicator, which is comatible with ABS (same author), and there you have a lot more control of the appearance . This way the user can also swip left-right to switch tabs.
Does this happen no matter what? I honestly haven't played too much with a native actionbar. What if you do something like an inset drawable? This would kind-of change how it's drawn and may shrink the icon, but might be a solution until you find something better.