@Override public void setNumStars(int numStars) { super.setNumStars(numStars); // mDrawable can be null during super class initialization. if (mDrawable != null) { mDrawable.setStarCount(numStars); } }
public RatingBar setNumStars(@IdRes int id,int numStars){ RatingBar ratingBar = getView(id); ratingBar.setNumStars(numStars); return ratingBar; }
protected void showRatingAlert() { // TODO Auto-generated method stub AlertDialog.Builder ab = new AlertDialog.Builder(AndroidLoadImageFromURLActivity.this); ab.setTitle("Enter Rating");ab.setMessage("STARS"); //inflating layout and finding RatingBar widget View root = ((LayoutInflater) AndroidLoadImageFromURLActivity.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.rating, null); ab.setView(root); final RatingBar rat = (RatingBar)root.findViewById(R.id.ratingbar); rat.setNumStars(5); ab.setIcon(R.drawable.ic_launcher); //and all your existing code ...
setContentView(R.layout.activity_main); ViewGroup container = (ViewGroup)findViewById(R.id.question_content); for(int i=0;i<4;i++){ LayoutInflater inflate = LayoutInflater.from(mContext); ViewGroup base = (ViewGroup)inflate.inflate(R.layout.item_layout, container, false); TextView month_name = base.findViewById(R.id.month_name); month_name.setText("Jan 2014"); TextView Day_Month = base.findViewById(R.id.day_month); Day_Month.setText("12 Jan"); TextView Ques_Title=new TextView(R.id.ques_title); Ques_Title.setText("This Is The Title"); TextView Ques_Desc=new TextView(R.id.ques_desc); Ques_Desc.setText("This Is The Description Of Question"); RatingBar ratingBar=new RatingBar(R.id.rating_bar); ratingBar.setNumStars(1); TextView People_Rated=new TextView(R.id.day_month); People_Rated.setText("9 People Rated This"); container.addView(base); }
RatingBar rb = (RatingBar) view.findViewById(rbars[r]); rb.setNumStars(Integer.valueOf(SP.getString(rchars[r], "3"))); rb.setMax(Integer.valueOf(SP.getString(rchars[r],"3"))); rb.setRating(2);
RatingBar rb = new RatingBar(context, null, android.R.attr.ratingBarStyleSmall); rb.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); rb.setIsIndicator(true); rb.setNumStars(3); rb.setMax(3);
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_result); //get rating bar object RatingBar bar=(RatingBar)findViewById(R.id.ratingBar1); bar.setNumStars(5); bar.setStepSize(0.5f); //get text view TextView t=(TextView)findViewById(R.id.textResult); //get score Bundle b = getIntent().getExtras(); int score= b.getInt("score"); //display score bar.setRating(score); switch (score) { case 1:t.setText("Your text here"); break; case 2: t.setText("Your text here"); break; case 3:t.setText("Your text here"); break; case 4:t.setText("Your text here"); break; case 5:t.setText("Your text here"); break; } }
txtDate.setText("Date Viewed: " + movies.get(position).dateViewed); ratingBar.setIsIndicator(true); ratingBar.setNumStars(movies.get(position).rating); ratingBar.setRating(movies.get(position).rating); return movieView;
FrameLayout frameLayout = (FrameLayout) findViewById(R.id.container); RatingBar rate = new RatingBar(this); rate.setRating(2); rate.setNumStars(4); rate.setProgress(1); rate.setLayoutParams(new FrameLayout.LayoutParams( FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT)); frameLayout.addView(rate);
mainScreen); final RatingBar rating = new RatingBar(mainScreen); rating.setNumStars(5); rating.setStepSize(0.1f); rating.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,
ll = (LinearLayout) itemView.findViewById(R.id.ll); rb = new RatingBar(context); rb.setNumStars(10); rb.setStepSize(1); ll.addView(rb);
RatingBar rt =(RatingBar)findViewById(R.id.ratingBar); rt.setIsIndicator(true); rt.setNumStars(5); rt.setStepSize(0.5f); rt.setRating(2.5f);
difficultyBar.setNumStars(GameDifficulty.getValidDifficultyList().size()); difficultyBar.setMax(GameDifficulty.getValidDifficultyList().size()); difficultyBar.setRating(GameDifficulty.getValidDifficultyList().indexOf(gic.getDifficulty())+1);
final RatingBar rating = new RatingBar(mActivity); rating.setId(feedback.getId()); rating.setNumStars(5); rating.setStepSize(0.1f); rating.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
difficultyBarView.setNumStars(GameDifficulty.getValidDifficultyList().size()); difficultyBarView.setRating(infos.getDifficulty().ordinal()); difficultyView.setText(rootView.getResources().getString(infos.getDifficulty().getStringResID()));
@NonNull @Override public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) { View view = convertView; if (view == null) { LayoutInflater layoutInflater = MainContext.INSTANCE.getLayoutInflater(); view = layoutInflater.inflate(R.layout.channel_rating_details, parent, false); } WiFiChannel wiFiChannel = getItem(position); if (wiFiChannel == null) { return view; } view.<TextView>findViewById(R.id.channelNumber) .setText(String.format(Locale.ENGLISH, "%d", wiFiChannel.getChannel())); view.<TextView>findViewById(R.id.accessPointCount) .setText(String.format(Locale.ENGLISH, "%d", channelRating.getCount(wiFiChannel))); Strength strength = Strength.reverse(channelRating.getStrength(wiFiChannel)); RatingBar ratingBar = view.findViewById(R.id.channelRating); int size = Strength.values().length; ratingBar.setMax(size); ratingBar.setNumStars(size); ratingBar.setRating(strength.ordinal() + 1); int color = ContextCompat.getColor(getContext(), strength.colorResource()); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { setRatingBarColor(ratingBar.getProgressDrawable(), color); } else { ratingBar.setProgressTintList(ColorStateList.valueOf(color)); } return view; }
ratingBar.setNumStars(getLikertMax()); ratingBar.setMax(getLikertMax()); ratingBar.setStepSize((float) getLikertStep());
public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromTouch) { final int numStars = ratingBar.getNumStars(); mRatingText.setText( getString(R.string.ratingbar_rating) + " " + rating + "/" + numStars); // Since this rating bar is updated to reflect any of the other rating // bars, we should update it to the current values. if (mIndicatorRatingBar.getNumStars() != numStars) { mIndicatorRatingBar.setNumStars(numStars); mSmallRatingBar.setNumStars(numStars); } if (mIndicatorRatingBar.getRating() != rating) { mIndicatorRatingBar.setRating(rating); mSmallRatingBar.setRating(rating); } final float ratingBarStepSize = ratingBar.getStepSize(); if (mIndicatorRatingBar.getStepSize() != ratingBarStepSize) { mIndicatorRatingBar.setStepSize(ratingBarStepSize); mSmallRatingBar.setStepSize(ratingBarStepSize); } }
public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromTouch) { final int numStars = ratingBar.getNumStars(); mRatingText.setText( getString(R.string.ratingbar_rating) + " " + rating + "/" + numStars); // Since this rating bar is updated to reflect any of the other rating // bars, we should update it to the current values. if (mIndicatorRatingBar.getNumStars() != numStars) { mIndicatorRatingBar.setNumStars(numStars); mSmallRatingBar.setNumStars(numStars); } if (mIndicatorRatingBar.getRating() != rating) { mIndicatorRatingBar.setRating(rating); mSmallRatingBar.setRating(rating); } final float ratingBarStepSize = ratingBar.getStepSize(); if (mIndicatorRatingBar.getStepSize() != ratingBarStepSize) { mIndicatorRatingBar.setStepSize(ratingBarStepSize); mSmallRatingBar.setStepSize(ratingBarStepSize); } }
difficultyText = (TextView) findViewById(R.id.difficultyText); final LinkedList<GameDifficulty> difficultyList = GameDifficulty.getValidDifficultyList(); difficultyBar.setNumStars(difficultyList.size()); difficultyBar.setMax(difficultyList.size()); difficultyBar.setOnRatingBarChangeListener(new RatingBar.OnRatingBarChangeListener() {