Reputation: 42824
progressbar
that i have defined for accepting the ratingRATINGbar = (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);
}
});
1-2-3-4-5
1
-1.5
-2
-2.5
-3
-3.5
-4
-4.5
-5
How to make my progress bar accept values in interval of 0.5
Hope i am clear
Upvotes: 2
Views: 611
Reputation: 5731
You can't change ProgressBar
intervals to float. Instead, try using RatingBar
.
Upvotes: 1
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