Note that there are some explanatory texts on larger screens.

plurals
  1. PO2-column TableLayout with 50% exactly for each column
    text
    copied!<p>This one puzzles me since my first steps with Android. I can't make both columns in a 2-column TableLayout exact 50% each.</p> <p>Here's an example:</p> <pre><code>&lt;ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="wrap_content" android:layout_width="fill_parent" &gt; &lt;TableLayout android:id="@+id/tablelayout" android:layout_height="wrap_content" android:layout_width="fill_parent" android:paddingRight="2dip" &gt; &lt;TableRow&gt; &lt;TextView style="@style/TextViewStandard" android_layout_span="2" android:layout_weight="1" android:text="Bla" /&gt; &lt;/TableRow&gt; &lt;TableRow&gt; &lt;TextView style="@style/TextViewStandard" android:layout_weight="1" android:text="Name:" /&gt; &lt;EditText style="@style/EditTextStandard" android:id="@+id/et_name" android:layout_weight="1" /&gt; &lt;/TableRow&gt; &lt;TableRow&gt; &lt;TextView style="@style/TextViewStandard" android:layout_weight="1" android:text="URL:" /&gt; &lt;EditText style="@style/EditTextStandard" android:id="@+id/et_url" android:layout_weight="1" /&gt; &lt;/TableRow&gt; &lt;TableRow&gt; &lt;Button style="@style/ButtonStandard" android:layout_column="0" android:layout_marginTop="6dip" android:onClick="onClickOk" android:text="@android:string/ok" /&gt; &lt;/TableRow&gt; &lt;/TableLayout&gt; &lt;/ScrollView&gt; </code></pre> <p>And here's the corresponding style definition:</p> <pre><code>&lt;resources&gt; &lt;style name="ButtonStandard" parent="@android:style/Widget.Button"&gt; &lt;item name="android:layout_height"&gt;wrap_content&lt;/item&gt; &lt;item name="android:layout_width"&gt;fill_parent&lt;/item&gt; &lt;/style&gt; &lt;style name="EditTextStandard" parent="@android:style/Widget.EditText"&gt; &lt;item name="android:layout_height"&gt;wrap_content&lt;/item&gt; &lt;item name="android:layout_marginLeft"&gt;2dip&lt;/item&gt; &lt;item name="android:layout_marginRight"&gt;2dip&lt;/item&gt; &lt;item name="android:layout_marginTop"&gt;2dip&lt;/item&gt; &lt;item name="android:layout_width"&gt;fill_parent&lt;/item&gt; &lt;/style&gt; &lt;style name="TextViewStandard" parent="@android:style/Widget.TextView"&gt; &lt;item name="android:layout_height"&gt;wrap_content&lt;/item&gt; &lt;item name="android:layout_marginLeft"&gt;2dip&lt;/item&gt; &lt;item name="android:layout_marginRight"&gt;2dip&lt;/item&gt; &lt;item name="android:layout_marginTop"&gt;2dip&lt;/item&gt; &lt;item name="android:layout_width"&gt;fill_parent&lt;/item&gt; &lt;item name="android:textColor"&gt;@android:color/white&lt;/item&gt; &lt;/style&gt; &lt;/resources&gt; </code></pre> <p>This becomes really messed up with a CheckBox involved.</p> <p>What's wrong with my definition?</p> <p>Many thanks in advance. HJW</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload