2009-11-16 32 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> 
相關問題