I am implementing tab layout in android. I am able to implement tabs however my implementation gives following output:

In this image, text “Tab 1” “Tab 2” “Tab 3” all are written at the bottom in tab. I want it to write on the top. I have already used android:gravity="top" as well as android:layout_gravity="top" but there did nothing for me. please help. i am using following layout:
<?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"
android:padding="5dp"
android:gravity="top"
android:layout_gravity="top"
>
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="top"
android:layout_gravity="top"
/>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp" />
</LinearLayout>
</TabHost>
please help.
We can achieve this by setting
TabSpeccontent with customized views.Here is the sample.in main.xml
in tabs_bg.xml
i use some custom selector for view, you can create on your own.
In activity Main.class,
which provide output like this…