3

My question is simple. Is it possible to create tabs entirely in xml? My app has only one activity. I want to have 2 tabs that show the same data but in slightly different layouts. It seems like it should be but I cannot find anything on it.

TIA,

Mark

codeHammer
  • 83
  • 1
  • 1
  • 7

1 Answers1

0

You can do something like this. Your layout for each tab would go inside a tabwidget. This will have it's limitations that you would easily get around if you employ a simple TabHost

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

    <!-- Tabs at bottom of screen -->
    <TabWidget
    android:background="@drawable/textview_top"
    android:layout_weight="12"
    android:id="@android:id/tabs"
    android:layout_width="fill_parent"
    android:layout_height="0dip"
    />
   </TabHost>
Tushar Vengurlekar
  • 7,649
  • 8
  • 33
  • 48
apesa
  • 12,163
  • 6
  • 38
  • 43