开发者

Android Tabs in XML

My question is simple. Is it possible to create tabs entirely in xml? My app has only one a开发者_StackOverflow社区ctivity. 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


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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜