As the title says, I was wondering if there is a way to add a way to create input in my Android application, by providing the user with a bar similar to the one used by Android system for adjusting the sound volume. A specific variable would change its value, according to the position of a "button" on the bar (sorry for my English). Any advice on that?
Asked
Active
Viewed 119 times
1 Answers
0
A SeekBar
is what you are looking for.
Here is the design spec: https://www.google.com/design/spec/components/sliders.html#
Here is the reference page: http://developer.android.com/reference/android/widget/SeekBar.html
If you want to set the value of the position of the SeekBar
, simply do:
seekBar.setProgress(position);
where position
is where you want the SeekBar
to be.
Getting the position of the SeekBar
is a bit more involved. Firstly you must set a setOnSeekBarChangeListener
and grab the SeekBar
value from within the onProgressChanged
method. This is a StackOverflow question that answers this well: get android seekbar value and display it on screen

Community
- 1
- 1

Tanishq dubey
- 1,522
- 7
- 19
- 42