Javatpoint Logo
Javatpoint Logo

Kotlin Android SeekBar

Android SeekBar is a kind of ProgressBar with a draggable thumb. The end user can drag the thumb left and right to move the progress of the song, file download etc.

The SeekBar.OnSeekBarChangeListener interface provides methods to perform even handling for seek bar.

We can create two types of SeekBar in Android

  • SeekBar with smooth progress.
  • SeekBar with discrete progress point.

The discrete progress point of SeekBar is created using attribute style="@style/Widget.AppCompat.SeekBar.Discrete" and specify the maximum point using attribute max.

Kotlin Android SeekBar Example

In this example, we will create the SeekBar with smooth progress and SeekBar with discrete progress point.

activity_main.xml

Add the SeekBar in the activity_main.xml layout.

MainActivity.kt

In this class, we call the SeekBar.OnSeekBarChangeListener interface and override its methods.

Output:

Kotlin Android SeekBar Kotlin Android SeekBar
Kotlin Android SeekBar Kotlin Android SeekBar
Kotlin Android SeekBar Kotlin Android SeekBar
Next Topic#




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


B.Tech / MCA