Home » Android » android – is it possible to make fixed ratingbar?

android – is it possible to make fixed ratingbar?

Posted by: admin May 14, 2020 Leave a comment

Questions:

I am getting rating from the web and want to show the rating by ratingbar.

But my problem is rating of ratingbar is changing when I slide a ratingbar.

I want the rating is fixed and do not changed by user’s touch.

is anybody able to limit control of ratingbar? How can I do that?

How to&Answers:

Use android:isIndicator="true" in your layout or setIsIndicator(boolean isIndicator) from code to prevent user interaction with the RatingBar widget.

Quote from the docs:

android:isIndicator – Whether this rating bar should only be an indicator (thus
non-changeable by the user).

Answer:

I don’t know if it works the way you want… make the Rating bar not focussable and not clickable by set setFocussableInTouchMode(false);, and setClickable(false);