Ratingbar Scoring bar System UI controls
Write Main.xml file :
<ratingbar
Android:id= "@+id/ratingbar"
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
android:layout_marginleft= "10dip"
Android:isindicator= "true"
Android:numstars= "5"
android:rating= "5" >
</RatingBar>
Effect slag slag: 650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/57/37/wKioL1SVMkeCQr88AABhY9wBWa8748.jpg "title=" Ratingbar.jpg "alt=" Wkiol1svmkecqr88aabhy9wbwa8748.jpg "/>
android:numstars= "5" setting shows the number of stars is 5, android:rating= "5" Setting the number selected is 5.
Android:isindicator= "true" setting does not change its state when selected
Custom Ratingbar Scoring bar
Above Ratingbar add a style property, remove android:isindicator= "true" property
1.main.xml Write down:
<ratingbar
Android:id= "@+id/ratingbar"
style= "@style/myratingbar"
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
android:layout_marginleft= "10dip"
Android:numstars= "5"
android:rating= "5" >
</RatingBar>
myratingbar. xml written in 2.values directory:
<?xml version= "1.0" encoding= "Utf-8"?>
<resources>
<style name= "myratingbar" parent= "@android: Style/widget.ratingbar" >
<itemname= "Android:progressdrawable" > @drawable/select_rating_bar</item>
<itemname= "Android:minheight" >16dip</item>
<itemname= "Android:maxheight" >16dip</item>
</style>
</resources>
Parent= "@android: Style/widget.ratingbar" inherits the style of the system Ratingbar
<itemname= "Android:minheight" >16dip</item> <itemname= "Android:maxheight" >16dip</item> Control the maximum and minimum height of the component
3.drawable directory under/select_rating_bar.xml writing:
<?xml version= "1.0" encoding= "Utf-8"?>
<layer-list xmlns:android= "Http://schemas.android.com/apk/res/android" >
<item
Android:id= "@+android:id/background"
android:drawable= "@drawable/luck" >
</item>
<item
Android:id= "@+android:id/secondaryprogress"
android:drawable= "@drawable/secondxing" >
</item>
<item
Android:id= "@+android:id/progress"
android:drawable= "@drawable/xing" >
</item>
</layer-list>
This sets the first level progress background picture (selected picture) two level progress background picture (unselected picture) and background picture, the application runtime will redraw these components
Recommendation: A more comprehensive example: http://www.apkbus.com/android-51346-1-1.html
Android about Ratingbar Rating strips