2009-11-16 55 views
2

如何在布局xml文件的同一行布局2个TextViews和SeekBar? 我知道如何在同一行布局2个TextViews(左边1个,右边1个)和SeekBar

但是我怎么能指定TextView(一个在右边,一个在左边)使用只需要它的宽度显示在TextView中的字符串,而SeekBar将用尽剩余的行?

而且我不知道每个TextView在开始时的文本值,这些TextView可以在我的应用程序中更改值。

谢谢你的任何建议。

回答

3

最简单的方法可能是使用TableLayout。例如:

<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> 
相关问题