简体   繁体   English

在android中使用评级栏

[英]Using rating bar in android

I have a rating Bar 我有一个评级栏

<RatingBar
            android:id="@+id/RATINGinitialvalueratingID"
            style="?android:attr/ratingBarStyleSmall"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_below="@+id/RATINGseekBarID"
            android:isIndicator="false"
            android:numStars="5" />

Say there are three stars in this .... i have two questions 说这里有三颗星......我有两个问题

  • How to show full stars all the time ? 如何一直展示满天星?
  • How to disable editing of stars (static display of allocated rating)? 如何禁用星标编辑(分配评级的静态显示)?

Try to add the following attribute to show 5 stars: 尝试添加以下属性以显示5颗星:

android:rating="5"

Also, try to add those to make it not editable: 另外,尝试添加它们以使其不可编辑:

android:isIndicator="true"
android:focusable="false"
android:clickable="false"

Try this.. 尝试这个..

RatingBar ratingBar = (RatingBar)findViewById(R.id.RATINGinitialvalueratingID);
ratingBar.setRating(5);
ratingBar.setFocusable(false);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM