DBILITY

안드로이드 seekbar 사용법 본문

android/kotlin

안드로이드 seekbar 사용법

DBILITY 2024. 2. 28. 16:33
반응형

package com.example.myex01

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import android.view.View
import android.widget.CheckBox
import android.widget.SeekBar
import androidx.core.view.children
import androidx.core.widget.addTextChangedListener
import com.example.myex01.databinding.ActivityMain3Binding
import kotlin.concurrent.thread

class MainActivity3 : AppCompatActivity() {

    private lateinit var binding: ActivityMain3Binding

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = ActivityMain3Binding.inflate(layoutInflater)
        setContentView(binding.root)

        binding.run {
            
            seekBar.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
                override fun onProgressChanged(
                    seekBar: SeekBar?,
                    progress: Int,
                    fromUser: Boolean
                ) {
                    textIndicator.text = progress.toString()
                }

                override fun onStartTrackingTouch(seekBar: SeekBar?) {
                    Log.d("onStartTrackingTouch","start")
                }

                override fun onStopTrackingTouch(seekBar: SeekBar?) {
                    Log.d("onStopTrackingTouch","stop")
                }
            })

        }
    }
}

반응형
Comments