首先看下面的图像.


package com.syncfusion.rating;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Region;
import android.view.View;
/**
* Created by chozarajan.pandiyarajan on 10/9/2015.
*/
public class SfRatingItem extends View {
private int fillColor,minDim,topXPoint,topYPoint;
private double bigHypot,bigA,bigB,littleHypot,littleA,littleB,value;
private Paint starPaint;
private Path path;
public SfRatingItem(Context context) {
super(context);
starPaint=new Paint();
fillPaint=new Paint();
path = new Path();
}
@Override
protected void onDraw(Canvas canvas) {
starPaint.setStyle(Paint.Style.FILL_AND_STROKE);
starPaint.setAntiAlias(true);
minDim = Math.min(this.getWidth() - this.getPaddingLeft() -this.getPaddingRight(), this.getHeight() - this.getPaddingTop() - this.getPaddingBottom());
bigHypot = (minDim / …Run Code Online (Sandbox Code Playgroud)