由网友(心劫)分享简介:由于封闭路径对象的结果是这样的:Given a closed Path object result is like this: 虽然这是我在寻找一些东西,与任何闭合路径工程的矩形。Although that is a rectangle I'm looking for something which works w...
由于封闭路径对象的结果是这样的:
Given a closed Path object result is like this:
虽然这是我在寻找一些东西,与任何闭合路径工程的矩形。
Although that is a rectangle I'm looking for something which works with any closed Path.
推荐答案
虽然steelbytes的回答可能让您欣赏到渐变的各个部分更多的控制,你可以做到这一点不带路径:
While steelbytes' answer will probably give you more control over the individual sections of the gradient, you can do it without the path:
protected void onDraw(Canvas canvas)
{
super.onDraw(canvas);
Paint p = new Paint();
// start at 0,0 and go to 0,max to use a vertical
// gradient the full height of the screen.
p.setShader(new LinearGradient(0, 0, 0, getHeight(), Color.BLACK, Color.WHITE, Shader.TileMode.MIRROR));
canvas.drawPaint(p);
}
相关推荐
最新文章