android-Basic Control (Ratingbar implementation)

Source: Internet
Author: User

1. Review

Learn about the knowledge of Android layout optimization, and SeekBar (draggable scroll bar) for understanding and learning

2. Focus

(1) Realization of Ratingbar

(2) Realization of Onratingbarchangelistener

3. Implement3.1

3.2 Layout Implementation

<relativelayout xmlns:android= ""    xmlns:tools= "http// "    android:layout_width=" match_parent "    android:layout_height=" Match_parent "    tools:context= "${relativepackage}.${activityclass}" >    <ratingbar        android:id= "@+id/rating_ Bar1 "        android:layout_width=" wrap_content "        android:layout_height=" wrap_content "        android:layout_ Alignparentleft= "true"        android:layout_below= "@+id/btn_debug"        android:layout_margintop= "28DP"/>< /relativelayout>

3.3 Onratingbarchangelistener implementation

The initialization control (Findviewbyid) is not said;

Using Toast display

Class Rating_bar1listener implements onratingbarchangelistener{@Overridepublic void onratingchanged (Ratingbar Ratingbar, float Rating,boolean fromuser) {              toast.maketext (this,rating+ "star", Toast.length_short). Show ();  }}

3.4 Binding Listener Events

Rating_bar1.setonratingbarchangelistener (New Rating_bar1listener ());

4. Demo Free point Download

Gift Toast Full solution!!!

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Android-Basic Control (Ratingbar implementation)

Related Article

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: 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.