Android layout 无法在tablelayout中调整微调器的大小

Android layout 无法在tablelayout中调整微调器的大小,android-layout,android-spinner,android-tablelayout,android-layout-weight,Android Layout,Android Spinner,Android Tablelayout,Android Layout Weight,运行AndroidStudio 1.0.2,我在调整微调器的大小时遇到问题。 我想在一条线上的布局是50/50 文本:微调器 Strings.xml <?xml version="1.0" encoding="utf-8"?> <resources> <string-array name="country_arrays"> <item>Malaysia</item> <item>Un

运行AndroidStudio 1.0.2,我在调整微调器的大小时遇到问题。 我想在一条线上的布局是50/50

文本:微调器

Strings.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>

    <string-array name="country_arrays">
        <item>Malaysia</item>
        <item>United States</item>
        <item>Indonesia</item>
        <item>France</item>
        <item>Italy</item>
        <item>Singapore</item>
        <item>New Zealand</item>
        <item>India</item>
    </string-array>

</resources>

马来西亚
美国
印度尼西亚
法国
意大利
新加坡
新西兰
印度
activity_main.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="horizontal">

    <TableLayout
        android:id="@+id/tblSpinner"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:weightSum="100">

        <TableRow>

            <TextView
                android:id="@+id/textViewSelect"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="50"
                android:text="Select item:"/>

            <Spinner
                android:id="@+id/spinner1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="50"
                android:entries="@array/country_arrays"/>
        </TableRow>
    </TableLayout>

</RelativeLayout>


目前,微调器占用了大约90%的宽度,而textview占了10%。

尝试更改android:layout\u width以填充父级

尝试将布局宽度从wrap\u内容更改为实际宽度。这将是具体的布局和平台,所以使用时要小心

<TableRow xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#33777777"
    android:layout_margin="1dip"
    android:gravity="center_vertical"
    android:padding="5dip">

    <TextView
        android:id="@+id/profileName"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="TextView\nthis" />

    <ProgressBar
        android:id="@+id/progressBar"
        style="?android:attr/progressBarStyle"
        a`ndroid:layout_width="30dip"`
        android:layout_height="wrap_content" />

</TableRow>


尝试将android:layout\u width更改为
fill\u parent
。非常感谢。成功了。几个小时来一直试图让它工作:)