Sherlockaction Bar NAVIGATION_MODE_TABS Changes on orentation? - android

When changing from a vertical view to a horizontal view, the NAVIGATION_MODE_TABS will automatic changes to a list? May i know how do i fix this to NAVIGATION_MODE_TABS ?

There is nothing to fix, as this is by design. The native action bar does this as well. I filed an issue pointing out this behavior, and was told that the action bar is working as intended. ActionBarSherlock, in turn, aims to mirror Android's native behavior.
If you want tabs that are always tabs, use anything other than action bar tabs, such as:
ViewPager with a tab indicator (PagerTabStrip, TabPagerIndicator from the ViewPagerIndicator library, etc.)
FragmentTabHost
Etc.

Related

FitsSystemWindows with translucent status bar and action bar tabs

In the app I am currently working on, I am working on implementing the translucent status bar with action bar tabs. I hide the ActionBar and only show the tabs.
My problem is that now, the system lets space for the action bar that is not there so FitsSystemWindows is making an error.
How can I fix that?
Thanks
The actual solution that time was quite dirty: I needed to set a custom padding from the top (I think it was 47dp or something like that) to the ViewPager (I think it was the ViewPager).
The real solution has come with AppCompat that fixes such issues: So use AppCompat!

ActionBarSherlock wrong tabs position on android 2.2.2

I'm having serious problems getting tabs in actionbarsherlock below main action bar tabs to work in an app that runs from Android 2.2 up and looks like Android 4. (see link)
Tabs position
Have you tried running the official Demos app of ActionBar Sherlock? (https://github.com/downloads/JakeWharton/ActionBarSherlock/ActionBarSherlock-Sample-Demos-4.2.0.apk) It should contain a demo for the actionbar with Tabs.
If that works on Android 2.2 then you know the problem is in your code and you can check the Demos source code to see what you are doing differently (https://github.com/JakeWharton/ActionBarSherlock/tree/master/samples).
It's usual behavior of action bar (actionbarsherlock just simulate it). Use
ActionBar act = getSupportActionBar();
act.setStackedBackgroundDrawable(getResources().getDrawable(R.drawable.mytab_base_t));
to avoid white color in top bar (this option you can't access from any theme item yet). You can also monitor action bar height to change custom view of tabs on-fly, but you can't change action bar behavior, forget it. Otherwise please use PagerTitleStrip against action bar tabs.

How can I allow horizontal tab navigation (swipe views) with action bar navigation tabs?

How can I allow horizontal tab navigation (swipe views) if I'm using action bar navigation tabs?
Is there anything special I have to do to get this to work with ActionBarSherlock?
The code-generated stuff for a "Tabs+Swipe" activity (from BlankActivity in the new activity wizard in Eclipse) has code for this. Basically, your tabs tie into a ViewPager, calling setCurrentItem() to change the page, rather than running their own FragmentTransaction or otherwise affecting the UI. The ViewPager handles the horizontal swiping, and you populate those pages using some form of PagerAdapter (one is code generated for you). See this very related question and answer for more.
Is there anything special I have to do to get this to work with ActionBarSherlock?
Other than standard stuff for using ActionBarSherlock, nothing out of the ordinary should be required. ViewPager is in the Android Support package, which ActionBarSherlock also needs, so you will have that already in your project.
Note, though, that action bar tabs only sometimes show up as tabs. In some screen sizes and orientations, they are automatically converted into a drop-down list (per "list navigation" with the action bar instead of "tab navigation"). If you want to use tabs all of the time, rather than using action bar tabs with ViewPager, use PagerTabStrip (from the Android Support package) or a suitable indicator from ViewPagerIndicator instead.

android action bar with tabs below the screen

For my application , I'm planning to have a design as this:
http://img811.imageshack.us/img811/7045/problemel.png
-Design needs to have a title bar which is indeed the action bar in android. To overcome the compatibility issues, I used the sherlock action bar which is said to support older versions that dont have action bars. I havent tested yet for the older devices however.
-As far as I know, for navigation , we could rather use tabbed or dropdown list methods. I want to have constant tabs for every page in my app to stand below the page. This reflects the tabbed action bar, however I want it below not just under the action bar. I don't know how but youtube application somehow has it in the middle of the screen (if it's not a custom view). So how do we have tabs positioned in the bottom of the page?
-Also I want to have another menu, whose items depend on the page it's on. But the apperance will be the same for every page. In the picture on the left this menu has buttons as "Bt 1" ,"Bt 2". I dont want to repeat the same xml for every activity page, but I'm not sure how to achieve it without repeating. If the action bar allowed using both navigation tabs and the drop down list, I could put the items of this menu in the dropdown list just as the picture on the right (onto the gray button). But I guess it does not?!
Therefore I have to repeat the menu xml code in every page or is there another smart way?
Any advice will be appreciated.
This can be achieved not with tabs but by adding items to a linear_layout with a gravity of bottom but it is a bad practice as #D_Steve595 stated and should be avoided in android designs.
actionBar.setHomeButtonEnabled(false);
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setDisplayShowHomeEnabled(false);

Actionbarsherlock layout params (align NAVIGATION_MODE_TABS at bottom)

I want to use Actionbarsherlock to make tabs aligned at the bottom of a layout. Where the fragment views load above it instead of below it.
How would this be done? currently in onCreate I am doing
getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
getSupportActionBar().setDisplayShowHomeEnabled(false);
getSupportActionBar().setDisplayShowTitleEnabled(false);`
and do not see an obvious function in getSupportActionBar() that facilitates its position onscreen.
Insight appreciated
This cannot be done. The tabs are built-in to the action bar which always remains at the top of the screen. The action bar behavior itself is dictated by the native action bar that's built-in to Android. ActionBarSherlock only mimics its behavior on pre-ICS.
If the native action bar does not support a feature then ActionBarSherlock will not be able to support it either.
A simpler way to do this would be to place a TabWidget at the bottom of the layout and theme them to look like the ICS-style tabs.

Categories

Resources