0

Draw a smooth line with finger touch on android. I set line's properties at first. I try many things. But still not working. My device is galaxy note 10.1 and G2.

    public CanvasClass(Context context, AttributeSet attrs) {
    super(context, attrs);
    // TODO Auto-generated constructor stub
    mPaint = new Paint();
    this.mPaint.setColor(Color.BLACK);
    this.mPaint.setStrokeWidth(8);
    this.mPaint.setAntiAlias(true);
    this.mPaint.setDither(true); // enable dithering
    this.mPaint.setStyle(Paint.Style.FILL); // set to STOKE
    this.mPaint.setStrokeJoin(Paint.Join.ROUND); // set the join to round you want
    this.mPaint.setStrokeCap(Paint.Cap.ROUND);  // set the paint cap to round too

}

/////////////////////////////////////////////////////////////////

    @Override
protected void onDraw(Canvas canvas) {
    // TODO Auto-generated method stub
    super.onDraw(canvas);


    if(!pointList.isEmpty())
        for(int i =0; i<pointList.size();i++){
            if(!pointList.get(i).getIsDown())

                canvas.drawLine(this.pointList.get(i-1).getValueX(), this.pointList.get(i-1).getValueY(), this.pointList.get(i).getValueX(), this.pointList.get(i).getValueY(), this.mPaint);
        }


}
Kara
  • 6,115
  • 16
  • 50
  • 57
  • Word of advice: it generally helps people to want to answer, if you say what's not working and what it's doing instead, rather than just "it's not working". – neminem Jan 07 '14 at 00:01
  • OK. I use "Path,moveTo and lineTo"[this link](http://stackoverflow.com/questions/8287949/android-how-to-draw-a-smooth-line-following-your-finger) – user3167224 Jan 07 '14 at 00:30
  • I test. I think "cap" was not working. Every parameter have same result – user3167224 Jan 07 '14 at 00:34

0 Answers0