I'm using rating bars in my Android application. But it only shows full stars, when I also want half stars.
I inserted a SQLite row with a name and the ratingValue, in there the ratingValue stands as "3.5" but my application turns it into "4". Even if my StepSize is "0.5", even the default value is changed to "3"
Here's some code
ListItem_layout
<TableRow>
<RatingBar
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="@+id/sportsRatingBar"
android:gravity="center_horizontal"
android:focusableInTouchMode="false"
android:isIndicator="true"
android:clickable="false"
android:focusable="false"
android:layout_column="1"
android:rating="2.5"
android:stepSize="0.5" />
ListItem
if(ratingBar!=null) {
ratingBar.setRating(p.getRating());
ratingBar.setTag(p.getId());
}
Reusable class
public float getRating() { return Rating; }
SQLite Table Column for rating
COLUMN_RATING + " real not null);"
And last, getting from database
c.getFloat(COLUMN_RATING_COL));
If anyone could help me with this?
Aucun commentaire:
Enregistrer un commentaire