È inoltre possibile utilizzare Rect.intersect() per trovare viste sovrapposte.
int[] firstPosition = new int[2];
int[] secondPosition = new int[2];
firstView.getLocationOnScreen(firstPosition);
secondView.getLocationOnScreen(secondPosition);
// Rect constructor parameters: left, top, right, bottom
Rect rectFirstView = new Rect(firstPosition[0], firstPosition[1],
firstPosition[0] + firstView.getMeasuredWidth(), firstPosition[1] + firstView.getMeasuredHeight());
Rect rectSecondView = new Rect(secondPosition[0], secondPosition[1],
secondPosition[0] + secondView.getMeasuredWidth(), secondPosition[1] + secondView.getMeasuredHeight());
return rectFirstView.intersect(rectSecondView);
fonte
2016-08-09 14:43:19
provare a utilizzare layout diverso – Pr38y
stai usando diversi layout per diverse risoluzioni dello schermo? –
Non riesco a cambiare il layout, è un desiderio del cliente! – smail2133