Imageview 사이에 line 그리기

canvas.drawLine(p1.x, p1.y, p2.x, p2.y, paint);

@Override
protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);

    //Draw previous rectangles
    for(int i=0;i<rectangles.size();i++){
        canvas.drawRect(rectangles.get(i), paintColor );
    }
    Rect ourRect = new Rect();

    ourRect.set(0, 0, canvas.getWidth()/2, canvas.getHeight()/2);

    Paint paintColor = new Paint();

    if(MainActivity.isBlue){
        paintColor.setColor(Color.BLUE);
    }

    paintColor.setStyle(Paint.Style.FILL);

    //Draw to actual canvas
    canvas.drawRect(ourRect, paintColor );
    rectangles.add(ourRect)

} }

https://stackoverflow.com/questions/15544026/draw-line-between-two-cordinates-in-ondraw-in-android

https://stackoverflow.com/questions/20641869/canvas-ondraw-android

onDraw안에 이를 넣어준다. – 아직 성공 못함

 

<ImageView center 구하는 방법>

예시)

row1.getX() + row1.getWidth() / 2, row1.getY() + row1.getHeight() / 2
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s