hap497
hap497

Reputation: 163225

How can I layout 2 TextViews (1 on left, 1 on right) and a SeekBar on the same line

How can I layout 2 TextViews and a SeekBar on the same line in my layout xml file? I know

But how can i specify TextView (one on the right, one on the left) to use only the width it needs to display the string in the TextView while SeekBar will use up the rest of the line?

And i don't know the text vale of each TextView in the beginning and these TextView can change value in my application.

Thank you for any suggestion.

Upvotes: 2

Views: 1664

Answers (1)

Jeremy Logan
Jeremy Logan

Reputation: 47514

The easiest way would probably be to use a TableLayout. Something like:

<TableLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" 
    android:stretchColumns="1">
    <TableRow>
        <TextView
            android:layout_width ="wrap_content" 
            android:layout_height="wrap_content"
            android:textSize     ="whatever" />
        <SeekBar
            android:layout_width ="fill_parent" 
            android:layout_height="wrap_content" />
        <TextView
            android:layout_width ="wrap_content" 
            android:layout_height="wrap_content"
            android:textSize     ="whatever" />
    </TableRow>
</TableLayout>

Upvotes: 3

Related Questions