Tuesday, 15 June 2010

Android Seekbar float values from 0.0 to 2.0 -


how to seekbar i have a with 2.0 to 0.0 ???? One ???? Can a value get ? Can anyone help me in the steps of 0.5 (0.0, 0.5, 1.0, 1.5, 2.0)?

SeekBar extends ProgressBar

ProgressBar is a method

  Public Zero setMax (integer max)   

Since it only ac ac accepts you will have to To get some conversion float from an integer value that you are after

you should do the trick like this:

  mSeekBar.setMax (4); // maximum = 4 so that potential values ​​are 0,1,2,3,4 seekbar.setOnSeekBarChangeListener (New OnSeekBarChangeListener) {Public Zero onProgressChanged (seekbar seekbar, integer progression, boolean fromUser) {// TODO Automatic built stub toast .makeText (seekBar.getContext (), "value:" + getConvertedValue (progress), toast.LENGTH_SHORT) .show ();} Public Zero onStartTrackingTouch (seekbar seekbar) {// TODO auto-created method stub} Public Zero onStopTrackingTouch ( SeekBar seekBar) {// TODO auto generated method stub}});   

This part will be in your creation () and you will have to use FindViewById () or something to get the MSEkabar reference.

  The converted value of the public float (int integral) {float float value = 0.0; FloatVal = .5f * intVal; Return flat val; }   

This is another way that you can add to your activity that will replace the values ​​with float within the required range.

No comments:

Post a Comment