首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

RatingBar自定义设立

2012-08-25 
RatingBar自定义设置1.?xml version1.0 encodingutf-8?resources?style namefoodRatingBar

RatingBar自定义设置

1.<?xml version="1.0" encoding="utf-8"?>
<resources>
?<style name="foodRatingBar" parent="@android:style/Widget.RatingBar">
??<item name="android:progressDrawable">@drawable/food_ratingbar_full</item>
??<item name="android:minHeight">48dip</item>
? ??<item name="android:maxHeight">48dip</item>
?</style>
</resources>

?

2.

<?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/food_ratingbar_full_empty" />
??? <item android:id="@+android:id/secondaryProgress"
????????? android:drawable="@drawable/food_ratingbar_full_empty" />
??? <item android:id="@+android:id/progress"
????????? android:drawable="@drawable/food_ratingbar_full_filled" />
</layer-list>

?

3.

?

<?xml version="1.0" encoding="utf-8"?>

<!-- This is the rating bar drawable that is used to
show a filled cookie. -->
<selector
??? xmlns:android="http://schemas.android.com/apk/res/android">

??? <item android:state_pressed="true"
????????? android:state_window_focused="true"
????????? android:drawable="@drawable/cookie" />

??? <item android:state_focused="true"
????????? android:state_window_focused="true"
????????? android:drawable="@drawable/cookie" />

??? <item android:state_selected="true"
????????? android:state_window_focused="true"
????????? android:drawable="@drawable/cookie" />

??? <item android:drawable="@drawable/cookie" />

</selector>

?

4.

<RatingBar ?android:id="@+id/my_rating_bar"
???...
???style="@style/foodRatingBar" />

?

?

热点排行