Answers
重写onDraw方法
里面调用
RadialGradient类试一试
我只做过直线的,没做过这种圆的
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
mRect = new Rect();
mRect.set(0, 0, showwidth, height);
Paint p=new Paint();
int color1 = Color.parseColor("#f1c40f");
int color2 = Color.parseColor("#f39c12");
// int rgb1 = Color.rgb(1, 1, 1);
// int rgb2 = Color.rgb(1, 1, 1);
// LinearGradient lg=new LinearGradient(0,0,screenWidth,0,color1,color2,TileMode.CLAMP); //
RadialGradient rg=new RadialGradient(x, y, radius, color0, color1, tile);
p.setShader(rg);
canvas.drawRect(mRect, p);
}
无节操的右脚
answered 11 years, 11 months ago