Source code
package android.support.v7.widget;
import android.content.Context;
import android.graphics.Bitmap;
import android.support.v4.view.ViewCompat;
import android.support.v7.appcompat.R;
import android.support.v7.internal.widget.TintManager;
import android.util.AttributeSet;
import android.widget.RatingBar;
public class AppCompatRatingBar extends RatingBar {
private AppCompatProgressBarHelper mAppCompatProgressBarHelper;
private TintManager mTintManager;
public AppCompatRatingBar(Context context) {
this(context, null);
}
public AppCompatRatingBar(Context context, AttributeSet attrs) {
this(context, attrs, R.attr.ratingBarStyle);
}
public AppCompatRatingBar(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
this.mTintManager = TintManager.get(context);
this.mAppCompatProgressBarHelper = new AppCompatProgressBarHelper(this, this.mTintManager);
this.mAppCompatProgressBarHelper.loadFromAttributes(attrs, defStyleAttr);
}
protected synchronized void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
Bitmap sampleTile = this.mAppCompatProgressBarHelper.getSampleTime();
if (sampleTile != null) {
setMeasuredDimension(ViewCompat.resolveSizeAndState(sampleTile.getWidth() * getNumStars(), widthMeasureSpec, 0), getMeasuredHeight());
}
}
}