2

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);

but it always 1px.

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

Community
  • 1
  • 1
Mikooos
  • 5,099
  • 4
  • 29
  • 44

2 Answers2

0

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

Kevin
  • 1,519
  • 12
  • 16
0

Add..

  colorCenter.setStyle(Paint.Style.STROKE);
Imdad Sarkar
  • 1,235
  • 2
  • 12
  • 24