Creating a Vertical Seekbar in Android

Vertical SeekBar ( For Android Nougat and above)

SeekBar is an extension of ProgressBar which has an added feature of draggable thumb.

Creating a horizontal seekbar is simple. But creating a vertical seekbar, its really tough if you are new to android. But believe me its really simple, just you have to add an extra attribute "rotation" to seekbar when defining it in xml layout just like below.

<SeekBar
android:id="@+id/seekBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:rotation="270"/>
or
<SeekBar
android:id="@+id/seekBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:rotation="90"/>

But wait. If you want to make it compatible for every devices and every Android OS, then you have to add one more attribute to it. Along with "rotation" attribute you have to add "splitTrack" attribute for the seekbar to appear vertical in your layout if you want it to work on android Lollipop or above.

<SeekBar
android:id="@+id/seekBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:rotation="270"
android:splitTrack="false"/>

Comments

  1. OK great but how do you put it to the side of a recyclerView??

    ReplyDelete
  2. Coin Casino Online Casino - Best Casino Sites & Bonus Codes
    Are you looking for the best casino online in 2021? At the 인카지노 best of our 1xbet casinos, you can 카지노사이트 always play at the best casino sites with bonuses.

    ReplyDelete

Post a Comment

Popular posts from this blog

Get a Pluralsight Subscription for free