Android Spinner上的值重叠

Android Spinner上的值重叠,android,Android,以前有人遇到过这样的问题吗?微调器的新值与旧值重叠,而不是替换它 <LinearLayout android:id="@+id/mainLayout" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLe

以前有人遇到过这样的问题吗?微调器的新值与旧值重叠,而不是替换它

    <LinearLayout
        android:id="@+id/mainLayout"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="20dp"
        android:layout_marginRight="20dp"
        >

        <TextView
            android:layout_marginTop="20dp"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="5dp"
            android:text="@string/textViewSearchField"
            />

        <Spinner
            android:id="@+id/spinnerSearchField"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginTop="10dp"
            android:layout_marginBottom="30dp"
            android:entries="@array/arraySearchFields"
            />

        ...

    </LinearLayout>

</ScrollView>
这发生在应用程序启动时。此外,我发现它发生在我的平板电脑上,而不是手机上

    <LinearLayout
        android:id="@+id/mainLayout"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="20dp"
        android:layout_marginRight="20dp"
        >

        <TextView
            android:layout_marginTop="20dp"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="5dp"
            android:text="@string/textViewSearchField"
            />

        <Spinner
            android:id="@+id/spinnerSearchField"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginTop="10dp"
            android:layout_marginBottom="30dp"
            android:entries="@array/arraySearchFields"
            />

        ...

    </LinearLayout>

</ScrollView>
相关代码:

    <LinearLayout
        android:id="@+id/mainLayout"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="20dp"
        android:layout_marginRight="20dp"
        >

        <TextView
            android:layout_marginTop="20dp"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="5dp"
            android:text="@string/textViewSearchField"
            />

        <Spinner
            android:id="@+id/spinnerSearchField"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginTop="10dp"
            android:layout_marginBottom="30dp"
            android:entries="@array/arraySearchFields"
            />

        ...

    </LinearLayout>

</ScrollView>
我的布局文件:

    <LinearLayout
        android:id="@+id/mainLayout"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="20dp"
        android:layout_marginRight="20dp"
        >

        <TextView
            android:layout_marginTop="20dp"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="5dp"
            android:text="@string/textViewSearchField"
            />

        <Spinner
            android:id="@+id/spinnerSearchField"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginTop="10dp"
            android:layout_marginBottom="30dp"
            android:entries="@array/arraySearchFields"
            />

        ...

    </LinearLayout>

</ScrollView>

您确定只有一个微调器,而没有一个被另一个微调器覆盖吗?或者你的微调器被一些文本视图覆盖了。向我们展示代码和xml布局您可以添加代码以便更好地理解吗。@斯坦,我已经上传了相关代码。我一辈子也弄不明白为什么会发生这种情况。尝试将数据加载到微调器,并在activity的代码中初始化它,而不是在xml的android:entries=@array/arraySearchFields中初始化它