【问题标题】:Can't change the width of Spinner inside TableRow in Android无法在 Android 中更改 TableRow 内 Spinner 的宽度
【发布时间】:2014-03-03 01:48:29
【问题描述】:

我在 TableRow 中放置了一个 TextView 和一个 Spinner,但我无法更改 Spinner 的宽度。当我把它放在 RelativeLayout 中时,一切正常,我可以设置自定义宽度、wrap_content 或 match_parent,但是当我把它放在 TableRow 中时,无论我做什么,它都有一个恒定的宽度。谁能告诉我如何使它成为 TableRow 中的 match_parent?

<TableLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/logo" >

    <TableRow
        android:id="@+id/tableRow1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <TextView
            android:id="@+id/textView1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/text"
            android:textSize="18sp" />

        <Spinner
            android:id="@+id/spinner1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="5dp"
            android:drawSelectorOnTop="true"
            android:entries="@array/items"
            android:prompt="@string/prompt"
            android:textSize="18sp" />
    </TableRow>
</TableLayout>

【问题讨论】:

    标签: android-spinner android-tablelayout


    【解决方案1】:

    对于微调器:

    android:layout_weight="1"

    这对我有帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-09-19
      • 2019-12-12
      • 2015-08-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多