在Android中绘图时如何设置线条的宽度?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1963686/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do you set a line's width when drawing in Android?
提问by AndroiDBeginner
How to set Line width? What method is used for it?
如何设置线宽?使用什么方法?
回答by John Feminella
Check out Paint.setStrokeWidth()
.
You draw by making various Drawable
objects. The objects themselves are separated from the instructions about how to draw them; that's covered by the Paint
class. Paint
instances have a method that allows you set the width of the stroke that will be used to draw the objects, setStrokeWidth()
, which is what you want.
您可以通过制作各种Drawable
对象来绘画。对象本身与有关如何绘制它们的说明分开;这是Paint
课程所涵盖的。Paint
实例有一个方法,允许您设置将用于绘制对象的笔划宽度setStrokeWidth()
,这正是您想要的。