seekbar: 게이지바
activity_main.xml
SeekBar와 TextView 추가
MainActivity
class MainActivity : AppCompatActivity() {
@RequiresApi(Build.VERSION_CODES.O)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val seekBar = findViewById<SeekBar>(R.id.seekBar)
val textView = findViewById<TextView>(R.id.textView)
seekBar.max = 1000
seekBar.min = 10
seekBar.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener{
override fun onProgressChanged(p0: SeekBar?, progress: Int, p2: Boolean) {
textView.text = "$progress"
}
override fun onStartTrackingTouch(p0: SeekBar?) {
}
override fun onStopTrackingTouch(p0: SeekBar?) {
}
})
}
}
'안드로이드' 카테고리의 다른 글
[Android] DatePicker (0) | 2022.03.28 |
---|---|
[Android] RatingBar (0) | 2022.03.28 |
[Android] 서버에 저장된 이미지 가져오기 (0) | 2022.03.28 |
[Android] VideoView (0) | 2022.03.25 |
[Android] GridView (0) | 2022.03.25 |
댓글