Devrath
Devrath

Reputation: 42824

Progressbar showing values in android

I have a progressbar that i have defined for accepting the rating

RATINGbar = (SeekBar)findViewById(R.id.RATINGseekBarID); // make seekbar object
        RATINGbar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {

            @Override
            public void onStopTrackingTouch(SeekBar seekBar) {
                // TODO Auto-generated method stub

            }

            @Override
            public void onStartTrackingTouch(SeekBar seekBar) {
                // TODO Auto-generated method stub

            }

            @Override
            public void onProgressChanged(SeekBar seekBar, int progress,
                    boolean fromUser) {
                // TODO Auto-generated method stub
                RATINGtextProgress = (TextView)findViewById(R.id.RATINGtextViewProgressID);
                RATINGtextProgress.setText("Rating:: "+progress);
                seekBar.setMax(5); 


            }
        }); 

This Bar accepts maximum of 5 number as i have defined !

How to make my progress bar accept values in interval of 0.5

Hope i am clear

Upvotes: 2

Views: 611

Answers (2)

Nizam
Nizam

Reputation: 5731

You can't change ProgressBar intervals to float. Instead, try using RatingBar.

Upvotes: 1

Simon Dorociak
Simon Dorociak

Reputation: 33495

How to make my progress bar accept values in interval of 0.5

Short answer:

You can't. ProgressBar takes only int values for actual and max progress and you can't change this behaviour. This how it's designated by OS.

Update: Look also at this thread.

Upvotes: 1

Related Questions