How to align your TabHost at the bottom of the screen

Posted by Unknown Kamis, 14 November 2013 0 komentar
There is a simplest way to align Tabbar at the bottom of the page.
The code is given below copy and download the code and try it...

In the previous example we learned a simple example to add Tabs to our application.Only a small change can give you tabs at the bottom of the page.

In the previous example the xml was like this...
 

<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:context=".MainActivity" >

<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >

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

<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />

</LinearLayout>

Instead of using Linear Layout use Relative Layout like below and use "android:layout_alignParentBottom="true"" for Tab Widget.
 
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:context=".MainActivity" >

<RelativeLayout
android:layout_height="fill_parent"
android:layout_width="fill_parent">


<TabWidget
android:id="@android:id/tabs"
android:layout_alignParentBottom="true"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />

<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</RelativeLayout>

</TabHost>
TERIMA KASIH ATAS KUNJUNGAN SAUDARA
Judul: How to align your TabHost at the bottom of the screen
Ditulis oleh Unknown
Rating Blog 5 dari 5
Semoga artikel ini bermanfaat bagi saudara. Jika ingin mengutip, baik itu sebagian atau keseluruhan dari isi artikel ini harap menyertakan link dofollow ke http://androidpopuler.blogspot.com/2013/11/how-to-align-your-tabhost-at-bottom-of.html. Terima kasih sudah singgah membaca artikel ini.

0 komentar:

Posting Komentar

Trik SEO Terbaru support Online Shop Baju Wanita - Original design by Bamz | Copyright of android populer.