0

I current have a TabHost within my app which opens each tab as an Activity in a FrameLayout. The tabs are designed to "Run" into each other, in other words they need to be side by side with no spaces by being aligned to the left. What I have noticed with the Tabbing system in Android is that the tabs all seem to be centered so using the images I need to means there are big spaces between the tabs. Is there any way to align all the tabs to the left and leave the rest of the screen to the right blank, or is there another way to remove the spaces between tabs?

SamRowley
  • 3,435
  • 7
  • 48
  • 77
  • If this is the look you want, you probably do not want `TabHost`. Cook up your own control strip and use `ViewFlipper` for the contents. Bear in mind that whatever solution you come up with here will not work on Honeycomb and forward, where tabs are in the action bar and should maintain a consistent UI. – CommonsWare Jun 01 '11 at 12:12
  • [android-remove-space-between-tabs-in-tabwidget][1] [1]: http://stackoverflow.com/questions/5799320/android-remove-space-between-tabs-in-tabwidget – Android Aug 23 '11 at 05:47

1 Answers1

1

I use the raletivelayout inside the TabHost, outside the TabWidget, say:

<RelativeLayout
                android:id="@+id/tab_layout" android:background="@color/tab_bg_color"
                android:layout_width="fill_parent" android:layout_height="60dip">
                <TabWidget android:id="@android:id/tabs" 
                android:layout_width="wrap_content" android:layout_height="wrap_content"
                android:paddingLeft="30dip" android:layout_alignParentLeft="true"
                android:layout_marginLeft="0dip" android:layout_marginRight="0dip" >
                </TabWidget>
</RelativeLayout>

Then the tabs are exactly on left. However, if you use the RelativeLayout, when you select from different activities, you will see "jumping" between them...

Livia Huang
  • 246
  • 2
  • 8