TableRow fill the remaining space

I have a layout as shown below:

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".SettingsActivity" > <TableRow ... </TableRow> <TableRow ... </TableRow> <TableRow android:id="@+id/tableRow3" android:layout_width="wrap_content" android:layout_height="wrap_content" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Temperature:" /> <SeekBar android:layout_width="wrap_content" android:layout_height="wrap_content" /> </TableRow> 

In the third, TableRow TextView and SeekBar share the space equally. I want the TextView be just as wide, it's the text inside it, and the SeekBar should fill the rest of the space. I tried to tinker with gravity, width and weight. What is the best way to get this behavior?

+4
source share

Source: https://habr.com/ru/post/1494392/


All Articles