The Wheat Academy's Android teacher gave you a picture of us speaking Android more unratingbar when it comes to Ratingbar is a good component of our system showing fractions, but we generally want to make the ratingbar more beautiful to decorate, To replace the system's default image with a picture that looks better, the system defaults to this:
Xml Code
1. <?xml version= "1.0" encoding= "Utf-8"?>
2. <resources>
3. <style name= "Foodratingbar" parent= "@android: Style/widget.ratingbar">
4. <item name= "android:progressdrawable">@drawable/food_ratingbar_full</item>< /c6>
5. <item name= "Android:minheight">48dip</item>
6. <item name= "Android:maxheight">48dip</item>
7. </style>
8. </resources>
Then build the Food_rating_bar_full.xml file under the Drawable folder, with the following contents:
Xml Code
1. <?xml version= "1.0" encoding= "Utf-8"?>
2. <layer-list xmlns:android= "http://schemas.android.com/apk/res/android">
3. <item android:id= "@+android:id/background"
4. android:drawable= "@drawable/food_ratingbar_full_empty" />
5. <item android:id= "@+android:id/secondaryprogress"
6. android:drawable= "@drawable/food_ratingbar_full_empty" />
7. <item android:id= "@+android:id/progress"
8. android:drawable= "@drawable/food_ratingbar_full_filled" />
9. </layer-list>
Food_ratingbar_full_empty is the image effect that is not selected, food_ratingbar_full_filled the picture effect is selected.
Finally, put the style into the Ratingbar to achieve your picture effect:
Xml Code
1. <ratingbar android:id= "@+id/my_rating_bar"
2 .....
3. style= "@style/foodratingbar" />
Android Tutorial case: Android Replacement Ratingbar Pictures