这玩意用html做可麻烦了
<RatingBar android:id="@+id/ratingBar1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_centerVertical="true" />
java中用法和seekbar差不多
import android.widget.RatingBar;
import android.widget.RatingBar.OnRatingBarChangeListener;
final RatingBar rb = (RatingBar)findViewById(R.id.ratingBar1); rb.setOnRatingBarChangeListener(new OnRatingBarChangeListener() { @Override public void onRatingChanged(RatingBar rb, float rating, boolean fromUser) { //float rate = rb.getRating(); //同步刷新progressBar的话,pb.setProgress((int) (rate/5*100)); //上面这行,先除以5*100,与先除以100*5是不同的 } });