Android Studio學習手冊-CheckBox

示意圖
  1. 建立新專案,參考下圖component tree建立布局
component tree

拉scroll view的時候系統會自動加入linear layout

2. ChkBox.isChecked()

如果有勾選到這個checkBox需要執行什麼動作

if(mChkBoxMusic.isChecked()){
s += mChkBoxMusic.getText().toString();
}

基本範例如上,當music的checkBox被勾選,string s加入"music"

完整範例檔(xml, java)請點github連結,搜尋checkBox

更多關於Android的文章:

RadioGroup, RadioButton1

RadioGroup, RadioButton2

NumberPicker數字轉輪

layout_constraintVertical_bias, layout_constraintHorizontal_bias

--

--

IM rookie

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store