views:

73

answers:

2

HI All

, i want to giv max and minimum limit of seekbar to 50 and 20 respectively. seekbar has a direct option top provide max value,but how can i set its minimum value to 20 rather than 0?? regards

A: 

Set the max value to 30 and add 20 to values you read from the seekbar :)

Romain Guy
+1  A: 

In SeekBar you can set only max value.

<SeekBar android:id="@+id/SeekBar01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:max="50"/>

And, You cannot directly set the minimum value to the seekbar.

 SeekBar mSeekbar = (SeekBar) findViewById(R.id.SeekBar01);

    mSeekbar.setOnSeekBarChangeListener(new OnSeekBarChangeListener()
    {
       public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser)
       {
            length_edit.setText(Integer.toString(progress + 20));
       }

      public void onStartTrackingTouch(SeekBar seekBar) {}

      public void onStopTrackingTouch(SeekBar seekBar) {}
    });

As you see min progress you can sum with min which I would like - in your case 20.

Enjoy !!!!

PM - Paresh Mayani
Well thanks for ur code,it is working, except the fact that, the textview i am using to set the progrees value, is not showing and app gets crashed.
shishir.bobby
@paresh sorry dude, waz on leave, dats y didnt responded..i upvoted and aaccepeted d answer...enjoy
shishir.bobby