Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable rating on RatingBar

Tags:

android

I'm using a RatingBar and OnRatingBarChangeListener in my Code. The user can the rating once and after this I set ratingBar.setEnabled(false) . I want to show the user advice that he can't rate anymore. How can I achieve to set a Toast after the user touches the disabled RatingBar?

Anybody an idea?

greetings

like image 283
marcel Avatar asked Oct 12 '11 18:10

marcel


People also ask

How do I turn off rating bars?

android:attr/ratingBarStyleSmall" or scaleX/scaleY the click interaction with RatingBar is disabled. This works for me. Hope this helps you!


2 Answers

You could set the rating to isIndicator after the user makes his first change You should prompt the user to make sure his change is exactly as he wished. It can get pretty difficult to rate when the property stepSize (how precise the rating is) is 0.5

//You could prompt the user using a dialog to confirm he is done rating  ratingBar.setIsIndicator(true); 

That should leave the UI unchanged(no greyish blur) and prevent the user from making a change (just like setEnabled(false))

In XML Layout

android:isIndicator="true" 

Hope it helped

like image 99
Br0thazS0ul Avatar answered Sep 30 '22 19:09

Br0thazS0ul


As @Br0therzS0ul noted, it's isIndicator.

Here's how in XMl:

android:isIndicator="true" 
like image 26
Mohsen Afshin Avatar answered Sep 30 '22 19:09

Mohsen Afshin