Android RatingBar - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android RatingBar class.

This code example shows how to use the following methods: setLayoutParams, setTag, setNumStars, setOnRatingBarChangeListener, setRating
    ViewWrapper wrap=null;
    View row=convertView;
                             
    if (convertView==null) {
      LinearLayout layout=new LinearLayout(ctxt);
      RatingBar rate=new RatingBar(ctxt);
       
      rate.setNumStars(3);
      rate.setStepSize(1.0f);
       
      View guts=delegate.getView(position, null, parent);
     
      layout.setOrientation(LinearLayout.HORIZONTAL); 
           
      rate.setLayoutParams(new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.WRAP_CONTENT,
            LinearLayout.LayoutParams.FILL_PARENT));
      guts.setLayoutParams(new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.FILL_PARENT,
            LinearLayout.LayoutParams.FILL_PARENT));

9
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: setLayoutParams, setNumStars, setRating
     */ 
	public void displayScore(int score){
		float rating = ((float)score)/2;
		TextView numericScore = new TextView(this);
		numericScore.setText("\n"+score);
		RatingBar rb = new RatingBar(this,null,android.R.attr.ratingBarStyleSmall);
		rb.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
		rb.setNumStars(5);
		rb.setRating(rating);
		layout.addView(rb);
		layout.addView(numericScore);
	} 
 
} 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: setLayoutParams, setNumStars, setOnRatingBarChangeListener, setRating, setStepSize
This code example shows how to use the following methods: setLayoutParams, setNumStars, setRating
     */ 
	public void displayScore(String username, int score){
		float rating = ((float)score)/2;
		TextView user = new TextView(this);
		user.setText("\n"+username);
		RatingBar rb = new RatingBar(this,null,android.R.attr.ratingBarStyleSmall);
		rb.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
		rb.setNumStars(5);
		rb.setRating(rating);
		hs.addView(user);
		hs.addView(rb);
	} 
	 
	/** 
     * Retrieves all scores from database and displays it 
     */ 
	public void displayDBScores(){ 
		Cursor c = db.getScores();
		if(c!=null) {
			c.moveToFirst();
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: setLayoutParams, setNumStars, setRating
     */ 
	public void displayScore(int score){
		float rating = ((float)score)/2;
		TextView numericScore = new TextView(this);
		numericScore.setText("\n"+score);
		RatingBar rb = new RatingBar(this,null,android.R.attr.ratingBarStyleSmall);
		rb.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
		rb.setNumStars(5);
		rb.setRating(rating);
		layout.addView(rb);
		layout.addView(numericScore);
	} 
 
} 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Android RatingBar Questions & Answers:

See Code Examples for Android RatingBar Methods: