Using xml Syntax Highlighting
- <?xml version="1.0" encoding="utf-8"?>
- <TabHost xmlns:android="http://schemas.android.com/apk/res/android"
- id="@android:id/tabhost"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent">
- <TabWidget id="@android:id/tabs" android:layout_width="fill_parent"
- android:layout_height="wrap_content" android:background="#f00">
- <FrameLayout id="@android:id/tabcontent" android:layout_width="fill_parent"
- android:layout_height="wrap_content" android:background="#f08">
- <TextView android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text="Hello World, TabView1" />
- </FrameLayout>
- </TabWidget>
- <TabWidget id="@android:id/tabs" android:layout_width="fill_parent"
- android:layout_height="wrap_content" android:background="#0f0">
- <FrameLayout id="@android:id/tabcontent" android:layout_width="fill_parent"
- android:layout_height="wrap_content" android:background="#f80">
- <TextView android:layout_width="fill_parent"
- android:layout_height="100px"
- android:text="Hello World, TabView2" />
- </FrameLayout>
- </TabWidget>
- <TabWidget id="@android:id/tabs" android:layout_width="fill_parent"
- android:layout_height="wrap_content" android:background="#00f">
- <FrameLayout id="@android:id/tabcontent" android:layout_width="fill_parent"
- android:layout_height="wrap_content" android:background="#a08">
- <TextView android:layout_width="fill_parent"
- android:layout_height="100px"
- android:text="Hello World, TabView3" />
- </FrameLayout>
- </TabWidget>
- <TabWidget id="@android:id/tabs" android:layout_width="fill_parent"
- android:layout_height="wrap_content" android:background="#a0f">
- <FrameLayout id="@android:id/tabcontent" android:layout_width="fill_parent"
- android:layout_height="wrap_content" android:background="#a08">
- <TextView android:layout_width="fill_parent"
- android:layout_height="100px"
- android:text="Hello World, TabView3" />
- </FrameLayout>
- </TabWidget>
- <TabWidget id="@android:id/tabs" android:layout_width="fill_parent"
- android:layout_height="wrap_content" android:background="#fff">
- <FrameLayout id="@android:id/tabcontent" android:layout_width="fill_parent"
- android:layout_height="wrap_content" android:background="#a08">
- <TextView android:layout_width="fill_parent"
- android:layout_height="100px"
- android:text="Hello World, TabView4" />
- </FrameLayout>
- </TabWidget>
- <!-- TextView
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text="Hello World, TabView"
- /-->
- </TabHost>
Parsed in 0.010 seconds, using GeSHi 1.0.8.4
Using java Syntax Highlighting
- package com.tbv;
- import android.app.Activity;
- import android.os.Bundle;
- import android.widget.TabHost;
- public class TabView extends Activity {
- /** Called when the activity is first created. */
- @Override
- public void onCreate(Bundle icicle) {
- super.onCreate(icicle);
- setContentView(R.layout.main);
- TabHost th=(TabHost)this.findViewById(android.R.id.tabhost);
- th.setup();
- }
- }
Parsed in 0.032 seconds, using GeSHi 1.0.8.4
One more thing that i observed is, eclipse showing TabHost as deprecated.
Is there anything that i can try to show multiple tabs?


