由于封闭路径对象的结果是这样的:
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);
}
上一篇:Google+的API plus.meAPI、Google、me、plus
下一篇:什么是所有&QUOT的详尽清单; android.intent.action"在Android SDK中提供的操作?详尽、清单、操作、android