Kotlin Android- How implement CheckBox.OnCheckedChangeListener?

前端 未结 4 1596
无人共我
无人共我 2021-01-07 16:56

I am new to Kotlin. I created a fragment and implemented View.OnClickListener and CheckBox.OnCheckedChangeListener. The View.OnClickListener

4条回答
  •  时光说笑
    2021-01-07 17:38

    var checkBox:CheckBox = CheckBox(context)
    checkBox.setOnCheckedChangeListener { buttonView, isChecked ->  
            if (isChecked) {
                    //Do Whatever you want in isChecked
            }
    }
    

提交回复
热议问题