Android Rating Bar shows only full stars, not half stars too
First of all the the way rating widget is defined it cannot accept values. Clickable is set to false and isIndicator is made true. To accept input define the widget in the following way
<RatingBar
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="@+id/sportsRatingBar"
android:gravity="center_horizontal"
android:rating="2.5"
android:stepSize="0.5" />
For the getting the values not sure about how the variable Rating is being set
Check out the image for how the widget looks like!
I think you don't need any library for this, I just tried it, and it working.
<android.support.v7.widget.AppCompatRatingBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="?android:attr/ratingBarStyle"
android:background="@android:color/holo_red_dark"
android:id="@+id/ratingBar1"
android:stepSize="0.1"
android:rating="2.5"/>
I set value of start to 4.5 and it is working that way.
RatingBar ratingBar = (RatingBar) findViewById(R.id.coloredRatingBar1);
ratingBar.setRating(4.8f);
ratingBar.setOnRatingBarChangeListener(new RatingBar.OnRatingBarChangeListener() {
@Override
public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromUser) {
Log.i(TAG, "onRatingChanged: rating : "+rating);
}
});