【问题标题】:How can I layout 2 TextViews (1 on left, 1 on right) and a SeekBar on the same line如何在同一行布局 2 个 TextView(左侧 1 个,右侧 1 个)和 SeekBar
【发布时间】:2010-12-17 05:46:40
【问题描述】:

如何在布局 xml 文件的同一行上布局 2 个 TextView 和一个 SeekBar? 我知道

但是我如何指定 TextView(一个在右边,一个在左边)只使用它在 TextView 中显示字符串所需的宽度,而 SeekBar 将用完该行的其余部分?

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

感谢您的任何建议。

【问题讨论】:

    标签: android


    【解决方案1】:

    最简单的方法可能是使用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>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-03-29
      • 1970-01-01
      • 1970-01-01
      • 2012-06-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多