Я хочу иметь пользовательскую кнопку ImageButton над TabWidget. Под вкладками я хочу разместить TableLayout. В основном мой макет должен выглядеть так:
|---------------------|
| RelaviteLayout |
| ------------------- |
| | ImageButton | |
| ------------------- |
| | TabWidget | |
| ------------------- |
| | TableLayout | |
| ------------------- |
|---------------------|
Весь макет должен быть прокручиваемым. И это помещается внутри диалога. Проблема в том, что это приводит к пустому пространству над ImageView, которое не прокручивается и ничего не рисует. Я думаю, это место занято TabHost. Я попытался установить его в View.INVISIBLE или VIEW.GONE, но это приводит к пустому диалогу, так как все остальное существует в TabHost.
-----------------------
| Empty Space |
-----------------------
|---------------------|
| RelaviteLayout |
| ------------------- |
| | ImageButton | |
| ------------------- |
| | TabWidget | |
| ------------------- |
| | TableLayout | |
| ------------------- |
|---------------------|
Я пробовал следующий файл layout.xml:
<TabHost
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:pse="http://schemas.android.com/apk/res/myProject
android:id="@+id/tabhost"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ScrollView
android:id="@+id/scrollview"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<view
class="project.com.MyImageButton"
android:id="@+id/myimagebutton"
android:background="@drawable/bg_btn_yellow_wood"
android:layout_alignParentTop="true"
android:minHeight="@dimen/btn_element_min_height_mdpi"
android:minWidth="@dimen/btn_element_min_width_mdpi" />
<TabWidget
android:id="@android:id/tabs"
android:layout_below="@id/myimagebutton"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@android:id/tabs" >
<TableLayout
android:id="@+id/TableView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TableRow
<TextView
android:text="foo"
android:layout_column="0"
android:padding="3dip" />
</TableRow>
</TableLayout>
<TableLayout
android:id="@+id/TableView02"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TableRow
<TextView
android:text="bar"
android:layout_column="0"
android:padding="3dip" />
</TableRow>
</TableLayout>
</FrameLayout>
</RelativeLayout>
</ScrollView>
</TabHost>
Есть ли способ расширить RelativeLayout или ScrollView, чтобы использовать весь диалог? Или есть способ избавиться от TabHost наверху?
Или пустое пространство - это что-то еще? Может быть, это не TabHost вообще. У кого-нибудь есть идеи?