首页 > 其他 > 详细

kotlin radiogroup,seekbar,edittext

时间:2018-05-14 23:24:27      阅读:630      评论:0      收藏:0      [点我收藏+]
rg.setOnCheckedChangeListener{_,checkedId ->
when(checkedId){
R.id.radioButton ->{
Write[0]=1
Toast.makeText(this, radioButton.text.toString(),
Toast.LENGTH_SHORT).show()
}
R.id.radioButton2 ->{
Write[0]=2
Toast.makeText(this, radioButton2.text.toString(),
Toast.LENGTH_SHORT).show()
}
}
}
seekBar?.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
// Write code to perform some action when progress is changed.
editText.setText(seekBar.progress.toString())
}

override fun onStartTrackingTouch(seekBar: SeekBar) {
// Write code to perform some action when touch is started.
}

override fun onStopTrackingTouch(seekBar: SeekBar) {
// Write code to perform some action when touch is stopped.

Toast.makeText(this@MainActivity, seekBar.progress.toString() , Toast.LENGTH_SHORT).show()
}
})
editText.addTextChangedListener(object : TextWatcher{
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {

}

override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
}

override fun afterTextChanged(s: Editable?) {
seekBar.setProgress(Integer.parseInt(editText.text.toString()))

}

})

kotlin radiogroup,seekbar,edittext

原文:https://www.cnblogs.com/hunter0541/p/9038666.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!