Android的画圆用不同颜色的边框 [英] Android drawCircle with different colour border

查看:117
本文介绍了Android的画圆用不同颜色的边框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能只用一个画圆法画在画布上一个圆圈在android系统用不同颜色的边框?

Is it possible to draw a circle on a canvas in android with a different colour border using only one drawCircle method?

我已经注意到FILL_AND_STROKE的PaintStyle,但不能似乎有不同的颜色填充和边框都。

I have noticed the PaintStyle of FILL_AND_STROKE but cant seem to have different colours for both the fill and the border.

我真的不希望有调用两个画圆的方法。

I really don't want to have to call two drawCircle methods.

感谢

推荐答案

Paint.Style的定义说:

Definition of Paint.Style says:

Paint.Style The Style specifies if the primitive being drawn is filled, 
stroked, or both (in the same color). 

所以看起来它不能在一气呵成完成。

So it seems it can't be done in one go.

如果你这样做了很多,你可以创建一个具有两个电话绘制镶上一圈静态辅助方法。

If you do this a lot you can create a static helper method that does two calls to draw bordered circle.

或者你可以创建一个自定义android.graphics.drawable.shapes.Shape对象,并重写它的Draw(..)方法。 <一href=\"http://developer.android.com/reference/android/graphics/drawable/shapes/Shape.html\">http://developer.android.com/reference/android/graphics/drawable/shapes/Shape.html

Or you could create a custom android.graphics.drawable.shapes.Shape object and override it's draw(..) method. http://developer.android.com/reference/android/graphics/drawable/shapes/Shape.html

这篇关于Android的画圆用不同颜色的边框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆