I want to put tabs at the bottom part of my screen . For this purpose I have the following code :
package info.androidhive.tabsswipe;
import info.androidhiv
Actually it's against Android Design Guideline since at bottom there are soft/hard buttons like back button home button etc.
http://developer.android.com/design/patterns/pure-android.html
But if you insist on to put them at the bottom, you can implement it like GitHub example consists tabs in bottom, using FragmentTabHost.
https://github.com/rameshkec85/BottomTabsFragmentTabHost
with an action bar you will only be able to add tabs at the top, since that is the way android apps should look like. Having tabs at the bottom is purely ios style. and if you still wish to achieve the same look at :
this. Github source can be found here
Don't do this, tabs should always be at the top in Android.
These sample xml code defines move tab to bottom of the screen:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TabHost
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@android:id/tabs" >
<FrameLayout
android:id="@+id/tab_home"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<FrameLayout
android:id="@+id/tab_video"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<FrameLayout
android:id="@+id/tab_audio"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</FrameLayout>
<FrameLayout
android:id="@+id/tab_blog"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</FrameLayout>
<FrameLayout
android:id="@+id/tab_gal"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</FrameLayout>
<FrameLayout
android:id="@+id/tab_more"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</FrameLayout>
</FrameLayout>
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" //align parent bottom mainly used for move the tab to bottom of the screen.
android:background="@drawable/ic_launcher"
android:divider="@null" />
<!-- android:background="#d8e49c" -->
</RelativeLayout>
</TabHost>
</LinearLayout>
one more solution: https://stackoverflow.com/a/23150258/2765497 for support api<11 replace TabView to FragmentTabVeiw and add enother imports from Sherlock of Support library