0
我正在創建一個android應用程序,並希望將我的活動設置爲可以選擇多個答案的問題。我在想單選按鈕,但我確定有一些更適合這項任務。實施例我應該使用什麼樣的安卓部件來爲問題做出多選答案?
Question
正確答案爲[X] ANSWER2 [X] ANSWER3 [X]
我正在創建一個android應用程序,並希望將我的活動設置爲可以選擇多個答案的問題。我在想單選按鈕,但我確定有一些更適合這項任務。實施例我應該使用什麼樣的安卓部件來爲問題做出多選答案?
Question
正確答案爲[X] ANSWER2 [X] ANSWER3 [X]
使用CheckBox
如果用戶可以選擇多個選項。
RadioButton
是用於當用戶只能選擇一個選項。
至於佈局:
這要看,有很多可能的解決方案,一種可能性是:
<!--not all attributes are included,such as width and height, you have to add them-->
<LinearLayout android:orientation="vertical">
<TextView />
<LinearLayout android:orientation="horizontal"> <!--contains options-->
<CheckBox /> <CheckBox/> <CheckBox />
</LinearLayout>
</LinearLayout>
使用TextView
的提問和ListView
與下面
ListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
你能推薦我應該使用的LayOut嗎? –
檢查更新的答案 –