开发者

Android how to draw line? [duplicate]

开发者 https://www.devze.com 2023-03-28 20:32 出处:网络
This question already has an answer here: Closed 11 years ago. Possible Duplicate: How do you set a line's width when drawing in Android?
This question already has an answer here: Closed 11 years ago.

Possible Duplicate:

How do you set a line's width when drawing in Android?

I've seen How to draw a line in android but how can I set line width? I tried to set Paint

    colorCenter = new Paint();
    colorCenter.setAntiAlias(true);
    colorCenter.setStrokeWidth(100);
    colorCenter.setColor(0xFF00FFFF);

then in onDraw()

canvas.drawLine(0, 0, 40, 40, colorCenter);
开发者_如何学JAVA

but it always 1px.

I also tried to find class LineShape and use it with ShapeDrawable, but there is no such class!


Add..

  colorCenter.setStyle(Paint.Style.STROKE);


get the Canvas and use drawLine(startX, startY, stopX, stopY, paint)

0

精彩评论

暂无评论...
验证码 换一张
取 消