Android Daily (13) star rating

Source: Internet
Author: User

This thing is done in HTML, but it's troublesome.

< Ratingbar         Android:id = "@+id/ratingbar1"         android:layout_width= "Wrap_content"        android:layout_height= "Wrap_ Content "        android:layout_alignparentleft=" true "        Android:layout_ centervertical= "true"/>

Java uses almost as much as Seekbar.

import Android.widget.RatingBar;

import Android.widget.RatingBar.OnRatingBarChangeListener;



FinalRatingbar RB =(Ratingbar) Findviewbyid (R.ID.RATINGBAR1); Rb.setonratingbarchangelistener (NewOnratingbarchangelistener () {@Override Public voidOnratingchanged (Ratingbar RB,floatrating,BooleanFromuser) { //Float rate = rb.getrating (); //Sync refresh ProgressBar words,pb.setprogress ((int) (rate/5*100)); //above this line, divide first by 5*100, and divide first by 100*5 is different } });

Android Daily (13) star rating

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.