I am trying to create a "two column" layout with check boxes.
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:stretchColumns="0,1"
>
<TableRow>
<CheckBox android:id="@+id/chkCapacitors"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Capacitors"
android:singleLine="false"
android:layout_weight="1"
/>
<CheckBox android:id="@+id/chkConnector"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Connectors"
android:singleLine="false"
android:layout_weight="1"
/>
</TableRow>
<TableRow>
<CheckBox android:id="@+id/chkModuleDevices"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Module Devices"
android:singleLine="false"
android:layout_weight="1"
/>
<CheckBox android:id="@+id/chkCircuitProtection"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Circuit Protection"
android:singleLine="false"
android:layout_weight="1"
/>
</TableRow>
</TableLayout>
And try as I might I cannot get the labels to display correctly. They look OK in the preview pane in Android Studio but when run on a device, Xperia S and Galaxy Note 3, the bottom of the text gets hidden if the label on one side is longer than the other.
If both labels in a row wrap to two/three lines then all is OK but if they wrap to differing lengths then I lose bits of text.
That's the reason the items are not in alphabetical order.
0 comments:
Post a Comment