1

I have about 10 check boxes and I can't go up or down to see all of them. How would I use scrollview to view them here's the xml for checkboxes.

`

<CheckBox
    android:id="@+id/CheckBox15"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="CheckBox" />


<CheckBox
    android:id="@+id/CheckBox14"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="CheckBox" />

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

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >
    </LinearLayout>


<CheckBox
    android:id="@+id/CheckBox13"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="CheckBox" />


<CheckBox
    android:id="@+id/CheckBox12"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="CheckBox" />


<CheckBox
    android:id="@+id/CheckBox11"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="CheckBox" />


<CheckBox
    android:id="@+id/CheckBox10"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="CheckBox" />

 </LinearLayout>

` I want to use scroll view on this checkbox list please helping.

4

1 に答える 1

4

ScrollView には 1 つの View または Layout のみを含めることができるため、LinearLayout を ScrollView 内に配置してから、その LinearLayout 内にチェックボックスを配置します。

<ScrollView>
<LinearLayout>
  <CheckBox />
  <CheckBox />
  <CheckBox />
  ....
</LinearLayout>
</ScrollView>
于 2012-06-07T19:22:11.220 に答える