Action bar tab tab width not fixed - android

my application contains action bar tab with fragments. it will add dynamically tabs to action bar. when multiple tabs added the text on tab gets wrapped. is there any way to set text in single line only

Take a look at this very useful library to work with ActionBar Tabs in android:
http://actionbarsherlock.com/
Hope it helps you! ;)

Related

android.widget.TabHost at the bottom and Action bar at the top together

I know the tabhost and tabwidget is deprecated but I have a design where I need to have a Tabhost with tabwidget to launch different activities with tab selection. With this , I also need to have an Action bar at the top depicting normal android's option's menu with search icon and so. Can anyone please provide me with example which is doing this.
So requirements are
1) Tabhost at bottom to launch separate activities with each tab
2) The common action bar for all tabhost's child activities showing options menu.
TIA.

Custom action bar with tabs wish to be at the bottom in android

I'm doing my project which is based on action bar tabs....I encountered with a problem.....it is
1.My requirement is i need to place 4 tabs at the bottom of the screen whenever I'm clicking the tab the view should be change.
2.So at first i choose tabs for this but i got to know that tabs are deprecated.
3.So i have chosen action bar with tabs and for view i have chosen fragments .
4.Still now every thing is fine and perfect.
5.But what i need is i need to place those tabs at the bottom.
6.And exactly i need tab view i tried split action bar for this but it doesn't appear to the tab view.
7.So dear developers can you please help me for this
I think i have given valid information .If you feel it as insufficient please let me know
While ActionBar has a manifest attribute: android:uiOptions="splitActionBarWhenNarrow" this won't work always, not for tabs.
The other option you have is to use a ViewPager with a FragmentStatePagerAdapter. This will make swipe-able pages from fragment. Now you can include PagerTabStrip or PagerTitleStrip in Activity layout, inside <ViewPager> tag, at top or at bottom by using android:layout-gravity attribute on it.
This will show and switch to fragment/page titles.

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

Action bar list navigation + tab navigation - Position of spinner is not at left most

According to Jake as in Android layout with action bar and tabs, we decide to follow his 2nd suggestion.
Use tab navigation in the action bar and set a custom view with a Spinner
Together with IcsSpinner from ActionBarSherlock itself, we manage to make it work in Gingerbread and ICS both.
However, we still suffer the following problem, during landscape mode.
Note, the spinner ("Portfolio 1") is in between PORTFOLIO tab and search icon. What we want is, the spinner is at the left side of WATCHLIST tab.
Is there anything we may try out?
Thanks.
You can set custom view for your action bar, user RelativeLayout to put your spinner at left side of "WATCH LiST"
in java code: actionBar.setCustomView(R.layout.custom_actionbar_layout)
a very late answer, but this is possible. You just have to replace (programatically) the view that is pointed by android.R.id.action_bar_title with a Spinner. I wrote a blog about it. Here's the link

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