I want to change my RatingBar
style programmatically. Anyone can help me how I change this style small how I can fill rating. I give you snapshot of current condition:
My code:
RatingBar ratingBar = new RatingBar(Review.this);
ratingBar.setStepSize((float) 0.5);
ratingBar.setMax(5);
ratingBar.setRating(Float.parseFloat(rating.get(i)));
Wrap your Rating Bar in LinearLayout
and give height and width to this LinearLayout
.
This LinearLayout
should act as a parent of RatingBar
and set the width and height of RatingBar
to wrap content
.
Also You can use
RatingBar ratingBar = new RatingBar(context, null, android.R.attr.ratingBarStyleSmall);