码迷,mamicode.com
首页 > 其他好文 > 详细

kotlin radiogroup,seekbar,edittext

时间:2018-05-15 00:37:10      阅读:328      评论:0      收藏:0      [点我收藏+]

标签:integer   write   sequence   onstop   started   pre   button   set   touch   

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

标签:integer   write   sequence   onstop   started   pre   button   set   touch   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!