How to add tabhost control on each page of our android application?
I want to display and handle ev开发者_开发知识库ents of tabhost control on each page of android application without creating it again and again, as in asp.net we have masterpage concept on which we can place our common controls, is there anything in android, so that i can place tabcontrol there.
You should extend you Activity with TabActivity and also use TabHost and TabSpec one example for xml is
<?xml version="1.0" encoding="utf-8"?>
<TabHost android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost">
<LinearLayout android:id="@+id/LinearLayout01"
android:orientation="vertical"
android:layout_height="fill_parent"
android:layout_width="fill_parent">
<TabWidget android:id="@android:id/tabs"
android:layout_height="wrap_content"
android:layout_width="fill_parent">
</TabWidget>
<FrameLayout android:id="@android:id/tabcontent"
android:layout_height="fill_parent"
android:layout_width="fill_parent">
</FrameLayout>
</LinearLayout>
</TabHost>
精彩评论