Xamarin – SeekBar control in Android
As a Windows Phone developer, it was hard to find the control in the Toolbox. Since I was searching for Slider control, thanks to the core Android guys who helped me out. In this post we would see SeekBar control and some of its properties.
As mentioned above, it is SeekBar to find in the toolbox. Select it and drag it to the design view.
The appearance of the SeekBar is like the following, however it would change based on the Android OS.
Here is the XML presentation of the layout.
If you want to set the maximum of the SeekBar value, use the property android:max.
If you want to set the current value, use the property android:progress
Here is the design view, after you applied above two properties.
Now we would how do we see what is the current value of the SeekBar at runtime. Well we would add a TextView to the layout and set it. The following is the layout.
We would subscribe to the ProgressChanged event handler. And set the Progress in the TextView. The following code is self-explanatory.
And here is the output you get, when you change the SeekBar value at runtime.
Hope this post helps, thanks for reading.
Full Source Code: Click Here