0

How can i set Tab Layout in Bottom? I try this property

android:gravity="bottom"
android:layout_marginBottom="-3dp" 

but not any effect and give error.

ghanshyam
  • 35
  • 1
  • 4
  • 1
    Show us your layout. Also check this question: http://stackoverflow.com/questions/3039674/tabwidget-not-stable-at-the-bottom-in-android-why – Olegas Feb 15 '12 at 08:02
  • [Look here](http://stackoverflow.com/a/6992662/593709) if you want iPhone like tab hosts. – Adil Soomro Mar 21 '12 at 11:11

2 Answers2

0
Place Tab Widget to below FrameLayout like this

<?xml version="1.0" encoding="utf-8"?>

<TabHost xmlns:android="http://schemas.android.com/apk/res/android" 
         android:id="@+id/tabHost"
         android:layout_width="fill_parent" 
         android:layout_height="fill_parent">
    <LinearLayout android:orientation="vertical"
                  android:layout_width="fill_parent" 
                  android:layout_height="fill_parent">

         <FrameLayout android:id="@android:id/tabcontent"
                     android:layout_width="fill_parent" 
                     android:layout_height="0dip"
                     android:layout_weight="1"  >

       </FrameLayout>


        <TabWidget android:id="@android:id/tabs"
                   android:layout_height="wrap_content" 
                   android:layout_width="fill_parent"
                   android:layout_weight="0" />



    </LinearLayout>
</TabHost>
Sam
  • 322
  • 1
  • 6
0

You have a best android Tab Layout to set that in Layout Bottom. Just use this code -

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="0dip"
android:layout_height="55dip"    
android:layout_weight="1"
android:orientation="vertical"

android:background="@drawable/tab_indicator"
android:padding="5dp">

<ImageView android:id="@+id/icon"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:src="@drawable/icon"

/> 

<TextView android:id="@+id/title"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true" 
    android:layout_centerHorizontal="true"
    style="?android:attr/tabWidgetStyle"
/>    

And, see this answer. Hope this helps you.

Community
  • 1
  • 1
Galaxy S2
  • 438
  • 1
  • 4
  • 10