0

我试图在滚动视图中容纳 4 个微调器。但我将无法做到这一点。有什么办法可以在 Scroll View 中容纳微调器?

4

1 回答 1

2

很简单:AScrollView只能容纳一个直接的孩子,所以如果你把微调器放在 a 里面,LinearLayout一切都会好起来的。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >


    <ScrollView
        android:id="@+id/scrollView1"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <Spinner
                android:id="@+id/spinner2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1" />

            <Spinner
                android:id="@+id/spinner1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1" />

            <Spinner
                android:id="@+id/spinner3"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1" />

            <Spinner
                android:id="@+id/spinner4"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1" />

        </LinearLayout>
    </ScrollView>

</LinearLayout>
于 2012-10-17T09:32:09.280 回答