Search in sources :

Example 56 with RatingBar

use of android.widget.RatingBar in project xdroid by shamanland.

the class ExampleBinder method onNewData.

@Override
public void onNewData(int position, View view, ExampleData data) {
    ViewHolder holder = ViewHolder.obtain(view);
    TextView text1 = holder.get(android.R.id.text1);
    if (text1 != null) {
        text1.setText(data.getTitle());
    }
    TextView text2 = holder.get(android.R.id.text2);
    if (text2 != null) {
        text2.setText(data.getSubTitle());
    }
    CompoundButton added = holder.get(R.id.added);
    if (added != null) {
        added.setChecked(data.isAdded());
    }
    RatingBar progress = holder.get(android.R.id.progress);
    if (progress != null) {
        progress.setRating((Math.abs(data.hashCode()) % 5) + 1);
    }
}
Also used : ViewHolder(xdroid.viewholder.ViewHolder) TextView(android.widget.TextView) RatingBar(android.widget.RatingBar) CompoundButton(android.widget.CompoundButton)

Example 57 with RatingBar

use of android.widget.RatingBar in project FastDev4Android by jiangqqlmj.

the class BaseAdapterHelper method setRating.

/**
 * Sets the rating (the number of stars filled) of a RatingBar.
 * 设置评分条的分数
 * @param viewId The view id.
 * @param rating The rating.
 * @return The BaseAdapterHelper for chaining.
 */
public BaseAdapterHelper setRating(int viewId, float rating) {
    RatingBar view = retrieveView(viewId);
    view.setRating(rating);
    return this;
}
Also used : RatingBar(android.widget.RatingBar)

Example 58 with RatingBar

use of android.widget.RatingBar in project YhLibraryForAndroid by android-coco.

the class YHRecyclerViewHolder method setRating.

public YHRecyclerViewHolder setRating(int viewId, float rating, int max) {
    RatingBar view = getView(viewId);
    view.setMax(max);
    view.setRating(rating);
    return this;
}
Also used : RatingBar(android.widget.RatingBar)

Aggregations

RatingBar (android.widget.RatingBar)58 View (android.view.View)35 TextView (android.widget.TextView)34 ImageView (android.widget.ImageView)27 LinearLayout (android.widget.LinearLayout)24 NavigationView (android.support.design.widget.NavigationView)23 ScrollView (android.widget.ScrollView)23 Intent (android.content.Intent)13 MotionEvent (android.view.MotionEvent)12 Bundle (android.os.Bundle)11 AlertDialog (android.app.AlertDialog)4 SuppressLint (android.annotation.SuppressLint)3 LayoutInflater (android.view.LayoutInflater)3 OnRatingBarChangeListener (android.widget.RatingBar.OnRatingBarChangeListener)3 Activity (android.app.Activity)2 DialogInterface (android.content.DialogInterface)2 CompoundButton (android.widget.CompoundButton)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 Before (org.junit.Before)2