tags:

views:

331

answers:

1

I'm looking for a way to implement a minimum value in my SeekBar and also have the option to increment decimal numbers. For example, currently my SeekBar's minimum is set to 0, but I need it to start at the value 0.2. Also, I would like to have the functionality to be able to have the user select a number from 0.2 to 10.0 at a .1 precision so they can choose the numbers 5.6 or 7.1.

Here are the style attributes for my SeekBar:

 <style name="SeekBar">
            <item name="android:paddingLeft">30dp</item>
            <item name="android:paddingRight">30dp</item>
            <item name="android:layout_width">fill_parent</item>
            <item name="android:layout_height">wrap_content</item>
            <item name="android:layout_marginTop">0dp</item>
            <item name="android:layout_marginBottom">0dp</item>
            <item name="android:max">10</item>
            <item name="android:progress">1</item>

    </style>
A: 

Hi @fordays, to set the starting progress you can do:

SeekBar yourSeekBar = (SeekBar) findViewById(R.id.seek_bar);
yourSeekBar.setProgress(20);

That should show your seekbar with your desired starting position (at 0.2) if the max is set to 100.

Zarah