Android-basic control (implemented by Ratingbar)

Source: Internet
Author: User

Android-basic control (implemented by Ratingbar)
1. Review

In the previous article, I learned about Android layout optimization and how to understand and learn SeekBar (you can drag a scroll bar ).

2. Key Points

(1) Implementation of RatingBar

(2) Implementation of OnRatingBarChangeListener

3. 3.1

3.2 layout implementation

 

     
  
 

 

3.3 OnRatingBarChangeListener implementation

 

The initialization control (findviewById) will not be mentioned;

Display with Toast

Class rating_bar1Listener implements OnRatingBarChangeListener {@ Overridepublic void onRatingChanged (RatingBar ratingBar, float rating, boolean fromUser) {Toast. makeText (this, rating + stars, Toast. LENGTH_SHORT ). show ();}}

 

3.4 bind a listening event

 

rating_bar1.setOnRatingBarChangeListener(new rating_bar1Listener());


 

 

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.