<?xml version="1.0" encoding="utf-8"?>
<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">
<LinearLayout android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content"
android:id="@+id/header">
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="woopra" android:textColor="#ffffff" android:textSize="36sp"
android:textStyle="bold"/>
</LinearLayout>
<FrameLayout android:layout_width="fill_parent" android:layout_height="wrap_content">
<TabWidget android:id="@android:id/tabs" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:visibility="gone"/>
<LinearLayout android:layout_width="fill_parent" android:layout_height="64dip">
<Button android:layout_height="fill_parent" android:layout_width="0dip"
android:layout_weight="1.0" android:id="@+id/dashboard_tab"
android:onClick="tabHandler" android:text="Dashboard"/>
<Button android:layout_height="fill_parent" android:layout_width="0dip"
android:layout_weight="1.0" android:id="@+id/visitors_tab"
android:onClick="tabHandler" android:text="Vistors"/>
<Button android:layout_height="fill_parent" android:layout_width="0dip"
android:layout_weight="1.0" android:id="@+id/chat_tab" android:onClick="tabHandler"
android:text="Chat"/>
<Button android:layout_height="fill_parent" android:layout_width="0dip"
android:layout_weight="1.0" android:id="@+id/reports_tab"
android:onClick="tabHandler" android:text="Reports"/>
</LinearLayout>
</FrameLayout>
<FrameLayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="0dip"
android:layout_weight="1.0"/>
</LinearLayout>
Здесь framelayout с идентификатором 'tabcontent' - это то, куда уходит содержимое нашей вкладки. Все, что вы поместите за пределы этого framwlayout, будет на вкладке независимо от выбранной вкладки.
Если вы посмотрите на верхнюю часть xml, вы увидите линейное расположение с идентификатором header. Это макет заголовка, который я сделал, который всегда будет виден в макете вкладки. Вы можете сделать то же самое, чтобы создать панель инструментов, поместив кнопки вместо текстовых представлений, как я сделал.