android: смешанная таблица со столбцами и многострочным текстом - PullRequest
5 голосов
/ 03 мая 2010

Я пытаюсь создать таблицу, содержащую несколько таблиц. Одна строка содержит 4 кнопки, а вторая строка содержит очень длинный текст. Однако ширина кнопки растягивается вместе с текстом во втором ряду. Есть ли способ предотвратить это?

альтернативный текст http://i40.tinypic.com/34srli0.jpg альтернативный текст http://i44.tinypic.com/2505dmf.jpg

http://img684.imageshack.us/i/tableview1.jpg/

http://img521.imageshack.us/i/tableview2.jpg/

Вот мой XML-файл: (каким-то образом этот сайт не подходит для XML-файла)

AbsoluteLayout
android:id="@+id/widget0"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
>

TableLayout
android:id="@+id/widget28"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_x="0px"
android:layout_y="10px"
>

TableRow
android:id="@+id/widget29"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>

Button
android:id="@+id/widget30"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
>
</Button>

Button
android:id="@+id/widget31"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
>
</Button>

Button
android:id="@+id/widget32"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
>
</Button>

Button
android:id="@+id/widget33"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
>
</Button>
</TableRow>

TableRow
android:id="@+id/widget35"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>

TextView
android:id="@+id/widget40"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextViewTextViewTextViewTextViewTextViewTextView"
>
</TextView>
</TableRow>

</TableLayout>
</AbsoluteLayout>

1 Ответ

3 голосов
/ 05 мая 2010

попробуйте использовать android: layout_span = "4" для TextView

Замените 4 на число столбцов (кнопок) в первом ряду.

Кроме того, вы можете оставить параметры Android: layout_width и layout_height из Tablerow

...