我有一个谷歌地图应用程序,用户可以在他们通过标记选择的餐厅中评分我在sq lite数据库中存储了该评分值,当他们点击视图评分时按钮我在滚动视图中显示字符串的名称和评分值。 现在我想要显示星星的评分值,即用户输入的方式。 如何显示存储在数据库中的星星数量
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:text="Rate me"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="20dp"
android:id="@+id/rateme"
android:layout_weight="0.00" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:text="Restaurent Name"
android:ems="10"
android:id="@+id/place"
android:layout_weight="0.00" />
<RatingBar
android:id="@+id/ratingBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:numStars="5"
android:stepSize="1.0"
android:rating="2.0"
android:layout_marginTop="64dp"
android:layout_below="@+id/place"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:ems="10"
android:id="@+id/rate"
android:layout_weight="0.00" />
<Button
android:text="Submit"
android:layout_width="395dp"
android:layout_height="wrap_content"
android:id="@+id/submit"
android:onClick="insert"/>
<Button
android:text="view Rating"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/viewrate"
android:layout_weight="0.00"
android:onClick="display"/>
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/button2" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:textStyle="bold" />
<RatingBar
android:id="@+id/rat"
style="?android:attr/ratingBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:numStars="5"
android:isIndicator="false"
android:layout_weight="0.07" />
/>
</LinearLayout>
</ScrollView>
</LinearLayout>
可以使用'RatingBar'为。 –