I need a star rating bar that can fit to width auto. When I try to resize on design screen; if screen is small some stars disappears (after 5th or 6th), if screen with is big all stars are visible.
How do I do it?
here is what do I have
<RatingBar
android:id="@+id/ratingBar1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:numStars="10"
android:rating="7" />
U can't set width but you can use custom Rating bar, just add :
compile 'FlexibleRatingBar:flexibleratingbar:1.3'
This rating bar will fit automatically. Than you initialize for example:
ratingBar = new FlexibleRatingBar(this);
ratingBar.setStepSize(1);
ratingBar.setColorFillOn(Color.rgb(65,105,225));
ratingBar.setColorFillPressedOn(Color.rgb(135,206,235));
someLayout.addView(ratingBar);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With