2012-04-20 49 views
0

我需要一個editText和10個複選框。在Android手機上,我也需要有一個滾動視圖。我的意思是我需要在滾動中看到複選框。怎麼做?android edittext和多個複選框

有人可以發佈佈局示例嗎?

回答

1
<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="vertical" android:layout_width="fill_parent" 
android:layout_height="fill_parent"> 
<EditText id ="@+id/edittext1" 
android:text="EditText 1" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
/> 
<ScrollView android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 
<LinearLayout 
    android:orientation="vertical" android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 
<CheckBox android:id="@+id/check" android:layout_width="wrap_content" 
    android:layout_height="wrap_content" android:text="@string/checkboxtest"/> 
<CheckBox android:id="@+id/check" android:layout_width="wrap_content" 
    android:layout_height="wrap_content" android:text="@string/checkboxtest"/> 
<CheckBox android:id="@+id/check" android:layout_width="wrap_content" 
    android:layout_height="wrap_content" android:text="@string/checkboxtest"/><CheckBox android:id="@+id/check" android:layout_width="wrap_content" 
    android:layout_height="wrap_content" android:text="@string/checkboxtest"/> 
</LinearLayout> 
</ScrollView> 
</LinearLayout> 
+0

同樣給你的努力... – MAC 2012-04-21 14:45:46

1

添加所有組件滾動型

<ScrollView....> 
<LinearLayout..> 
    <EditText /> 
    <CheckBox /> 
    <CheckBox /> 
    <CheckBox /> 
    <CheckBox /> 
    . 
    . 
    </LinearLayout..> 
</ScrollView> 
+0

日Thnx,我不認爲我們需要複製粘貼ň所有代碼......他/她可以通過這個瞭解... – MAC 2012-04-21 12:59:09