更新时间:2022-11-17 18:32:36
您应该能够使用Rect.intersects(Rect, Rect)
,例如以下示例:
You should be able to use Rect.intersects(Rect, Rect)
, like this example:
Rect myViewRect = new Rect();
myView.getHitRect(myViewRect);
Rect otherViewRect1 = new Rect();
otherView1.getHitRect(otherViewRect1);
Rect otherViewRect2 = new Rect();
otherView2.getHitRect(otherViewRect2);
if (Rect.intersects(myViewRect, otherViewRect1)) {
// Intersects otherView1
}
if (Rect.intersects(myViewRect, otherViewRect2)) {
// Intersects otherView2
}
引用为 查看全文