VerticalSeekBar控件是一个垂直的seekBar,你可以在https://github.com/lukelorusso/VerticalSeekBar上查看更多细节。
VerticalSeekBar控件中是否有像SeekBar控件中的onStopTrackingTouch事件函数?
希望当我停止拇指时,在VerticalSeekBar中进行一些操作。 代码A
希望当我停止拇指时,在VerticalSeekBar中进行一些操作。 代码A
horizontalSeekBar?.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
override fun onProgressChanged(seekBar: SeekBar, i: Int, b: Boolean) {
// Display the current progress of SeekBar
}
override fun onStartTrackingTouch(seekBar: SeekBar) {
// Do something
}
override fun onStopTrackingTouch(seekBar: SeekBar) {
requireContext().toast(seekBar.progress.toString() +"M")
}
})
verticalSeekBar?.setOnProgressChangeListener { progressValue ->
requireContext().toast( progressValue.toString()+"X")
}
布局A
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/camera_ui_container"
android:layout_width="match_parent"
android:layout_height="match_parent">
<SeekBar
android:id="@+id/horizontalSeekBar"
android:layout_width="100dp"
android:layout_height="30dp"
android:background="@color/white"
android:max="10"
android:thumb="@drawable/ic_thumb"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/verticalSeekBar"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.lukelorusso.verticalseekbar.VerticalSeekBar
android:id="@+id/verticalSeekBar"
android:layout_width="30dp"
android:layout_height="150dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:vsb_progress="2" />
</androidx.constraintlayout.widget.ConstraintLayout>