【发布时间】:2014-04-24 06:59:48
【问题描述】:
我只想在TableRow 中有一个 5 星的 RatingBar,但它总是得到 8 星。
但是我已经用android:numStars="5"通知了。
此外,它使用android:rating="4" 填充 7.5 星而不是 4 星
我所做的任何更改对布局都毫无意义。
我的 XML 如下:
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/drop_shadow"
android:orientation="vertical"
>
<TableRow
android:id="@+id/image_row"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:padding="5dp" >
<ImageView
android:id="@+id/grid_image"
android:layout_width="130dp"
android:layout_height="130dp" />
</TableRow>
<TableRow
android:id="@+id/text_row"
android:layout_width="wrap_content"
android:layout_height="70dp"
>
<TextView
android:id="@+id/grid_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxWidth="140dp"
android:text="Summary" />
</TableRow>
<TableRow
android:id="@+id/rate_row"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<RatingBar
android:id="@+id/product_rating"
style="?android:attr/ratingBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:isIndicator="true"
android:max="5"
android:numStars="5"
android:rating="4"
android:stepSize="1" />
</TableRow>
</TableLayout>
【问题讨论】: