我正在尝试编写代码,我应该以1为步骤更新评级,因为我获得了评级的整数值。这是相同的代码
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_marginRight="3dp" >
<RatingBar
android:id="@+id/PriceRating"
style="@style/foodRatingBarSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:isIndicator="true"
android:numStars="1"
android:stepSize="0.25"
android:max="5" />
</LinearLayout>
以下是样式文件中的代码:
<style name="foodRatingBarSmall" parent="@android:style/Widget.RatingBar">
<item name="android:progressDrawable">@drawable/foodratingbar_full</item>
<item name="android:minHeight">20dip</item>
<item name="android:maxHeight">20dip</item>
</style>
以下是foodratingbar文件
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@+id/background" android:drawable="@drawable/foodratingbar_fill"
/>
<item android:id="@+id/secondaryProgress"
android:drawable="@drawable/foodratingbar_fill" />
<item android:id="@+id/progress" android:drawable="@drawable/foodratingbar_empty" />
</layer-list>
以下是foodratingbar_fill的代码:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
android:state_window_focused="true"
android:drawable="@drawable/dollar" />
<item android:state_focused="true"
android:state_window_focused="true"
android:drawable="@drawable/dollar" />
<item android:state_selected="true"
android:state_window_focused="true"
android:drawable="@drawable/dollar" />
<item android:drawable="@drawable/dollar" />
</selector>
美元是png图像
我的代码的问题是我无法让它更新到所需的星数,我看到在android上显示的星数的模糊值。我想知道如何显示1美元的1美元图像,最多5个