Почему в моей таблице неодинаковая ширина столбцов? Вот полный макет: сначала таблица, затем две кнопки в LinearLayout за пределами таблицы, они разделены поровну.
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="4dp" >
<TableRow
android:layout_marginTop="2dp"
android:gravity="center_vertical" >
<TextView
style="@style/Label.Plain"
android:layout_width="match_parent"
android:text="@string/Caption" />
<EditText
android:background="#00ff00"
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="@dimen/button_height"
android:inputType="numberDecimal"
android:selectAllOnFocus="true"
android:textSize="@dimen/spinner_text" />
</TableRow>
</TableLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:layout_marginBottom="3dp"
android:gravity="center_vertical"
android:orientation="horizontal" >
<Button
android:id="@+id/btnOk"
style="@style/Button.Plain.Fill"
android:layout_weight="1"
android:text="@string/ALS_OK" />
<Button
android:id="@+id/btnClose"
style="@style/Button.Plain.Fill"
android:layout_weight="1"
android:text="@string/CANCEL" />
</LinearLayout>
</LinearLayout>
</ScrollView>
А вот как это выглядит (одна колонка закрашена для наглядности):

Я мог бы использовать здесь линейную компоновку, просто хочу понять логику TableLayout.
layout_weight1 от своего стиля, поэтому я забыл указать его здесь. - person Violet Giraffe   schedule 25.04.2013