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
Contextual code suggestions in your IDE  Get Codota for Java
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);
	} 
 
} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
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();
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
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);
	} 
 
} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setNumStars, setRating, setStepSize
    	 CharSequence sysTimeStr = DateFormat.format("MMMM dd, yyyy h:mmaa", timestamp);
    	 this.mTime.setText(sysTimeStr);
    } 
     
    public void setPoints(String mPoints) {
        this.mPoints.setNumStars(5);
        this.mPoints.setStepSize((float)0.5);
        float stars = Float.parseFloat(mPoints);
        this.mPoints.setRating(stars);
    } 
 
    public View getView(){
        return mView;
    } 
} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
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();
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
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));

6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setFocusable, setIsIndicator, setRating
public class RatingRenderer implements IFieldRenderer{ 
 
	@Override 
	public View renderField(IField column, Object fieldValue, IViewer table,
			Object object) {
		RatingBar rs=new RatingBar(table.getContext(),null,R.attr.ratingBarStyleSmall);		
		rs.setIsIndicator(true);
		 
		rs.setFocusable(false);		
		if (fieldValue!=null){
		rs.setRating((((Number)fieldValue)).floatValue());
		} 
		return rs;
	} 
 
	@Override 
	public void setPropValueToView(View renderedField, IField column,
			Object fieldValue, IViewer table, Object parenObj) {
		RatingBar rs=(RatingBar) renderedField;
		if (fieldValue!=null){
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
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));

6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related Android RatingBar Questions & Answers:

See Code Examples for Android RatingBar Methods: