4

I am creating a form in which i have to put five different smiley icon in rating bar to get feedback from user.

I tried but at a time only one type of icon is being displaying.

I am trying by changing style in style.xml

 <style name="customRatingBar" parent="@android:style/Widget.RatingBar">
            <item name="android:progressDrawable">@drawable/ratingstars</item>
            <item name="android:minHeight">32dip</item>
            <item name="android:maxHeight">32dip</item>
        </style>

Please suggest me how could we achieve this in android?

Thanks in advance.

roshni soni
  • 51
  • 1
  • 3
  • http://stackoverflow.com/questions/5800657/how-to-create-custom-ratings-bar-in-android – Murali Kumar Nov 23 '15 at 05:05
  • This is very difficult to do within the confines of the standard system `RatingBar` components. Android doesn't cater for 5 different images, rather for 1 image duplicated 5 times. As [Harry suggests](http://stackoverflow.com/a/34053945/383414), make your own with buttons. – Richard Le Mesurier Aug 14 '16 at 08:07

4 Answers4

6

Here is a ratingbar which uses face morphing animation to animate different smiley reactions.

enter image description here

SmileyRating github

You can clearly see that the smiley is changing its reaction slowly.

Sujith Niraikulathan
  • 2,111
  • 18
  • 21
2

From my experience with RatingBar I would say ditch it completely and implement your own mechanism for getting the feedback. Maybe a horizontal linear layout with 5 circular buttons?

0

I had the same problem and the only way I found is to make a LinearLayout with the 5 different faces as elements, and manually control touch position to change faces from selected to unselected, emulating how an old plain android RatingBar works.

I recently made a library out if this implementation, maybe it can help you.

An example of the library working with faces:

example of library working with faces

inlacou
  • 156
  • 1
  • 10
0

Checkout this EmojiRatingBar library. enter image description here

Unaisul Hadi
  • 620
  • 1
  • 7
  • 22