I got a layout, where I need to draw line between two sub views (between the two centers), but witouth the line overlapping the views themself
I succeeded draw line between the two centers using:
final int lineStartX = ((LayoutParams) viewA.getLayoutParams()).leftMargin + (viewA.getMeasuredWidth() / 2);
final int lineStartY = ((LayoutParams) viewA.getLayoutParams()).topMargin + (viewA.getMeasuredHeight() / 2);
final int lineEndX = ((LayoutParams) viewB.getLayoutParams()).leftMargin + (viewB.getMeasuredWidth() / 2);
final int lineEndY = ((LayoutParams) viewB.getLayoutParams()).topMargin + (viewB.getMeasuredHeight() / 2);
canvas.drawLine(lineStartX, lineStartY, lineEndX, lineEndY, mLinePaint);
But the line is visible on the views area also.
Drawing the views on the line is not considered as solution, because the views background should be transparent
How do I achieve that?
Thanks in advance!
Well I finally did it with my own implementation using Similar Triangles formula: http://www.mathopenref.com/similartriangles.html