Java Code Examples for android.widget.RatingBar#setOnRatingBarChangeListener()
The following examples show how to use
android.widget.RatingBar#setOnRatingBarChangeListener() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Activity_WaitComment.java From FoodOrdering with Apache License 2.0 | 6 votes |
private void initView() { Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar.setTitle(""); TextView toolbarText = (TextView) findViewById(R.id.toolbar_text); toolbarText.setText("评价订单"); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); } ratingBar = (RatingBar) findViewById(R.id.ratingBar_Comment); btnCommit = (Button) findViewById(R.id.btn_commit); etCommentContent = (EditText) findViewById(R.id.etCommentContent); tv_tip = (TextView) findViewById(R.id.tv_tip); btnCommit.setOnClickListener(this); ratingBar.setOnRatingBarChangeListener(this); }
Example 2
Source File: RatingsBarActivity.java From coursera-android with MIT License | 6 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final TextView tv = (TextView) findViewById(R.id.textView); final RatingBar bar = (RatingBar) findViewById(R.id.ratingbar); bar.setOnRatingBarChangeListener(new OnRatingBarChangeListener() { // Called when the user swipes the RatingBar @Override public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromUser) { tv.setText("Rating:" + rating); } }); }
Example 3
Source File: RatingsBarActivity.java From coursera-android with MIT License | 6 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final TextView tv = findViewById(R.id.textView); final RatingBar bar = findViewById(R.id.ratingbar); bar.setOnRatingBarChangeListener(new OnRatingBarChangeListener() { // Called when the user swipes the RatingBar @Override public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromUser) { tv.setText(getString(R.string.rating_string, rating)); } }); }
Example 4
Source File: MovieDetailFragment.java From Movie-Check with Apache License 2.0 | 5 votes |
@Override public void showVoteAverage(float voteAverage) { textViewVoteCount.setVisibility(View.VISIBLE); RatingBar newRatingBar = new RatingBar(new ContextThemeWrapper(getActivity(), R.style.RatingBarAccent)); newRatingBar.setRating(voteAverage / 2); newRatingBar.setIsIndicator(true); newRatingBar.setOnRatingBarChangeListener(onRatingBarChangeListener); ((ViewGroup) ratingBarVoteAverage.getParent()).addView(newRatingBar, 0); ((ViewGroup) ratingBarVoteAverage.getParent()).removeView(ratingBarVoteAverage); ratingBarVoteAverage = newRatingBar; }
Example 5
Source File: MovieDetailFragment.java From Movie-Check with Apache License 2.0 | 5 votes |
@Override public void showUserClassification(Float classification) { textViewVoteCount.setVisibility(View.INVISIBLE); RatingBar newRatingBar = new RatingBar(new ContextThemeWrapper(getActivity(), R.style.RatingBarRed)); newRatingBar.setRating(classification); newRatingBar.setIsIndicator(false); newRatingBar.setOnRatingBarChangeListener(onRatingBarChangeListener); ((ViewGroup) ratingBarVoteAverage.getParent()).addView(newRatingBar, 0); ((ViewGroup) ratingBarVoteAverage.getParent()).removeView(ratingBarVoteAverage); ratingBarVoteAverage = newRatingBar; }