【发布时间】:2014-04-08 19:58:32
【问题描述】:
有没有办法在 Android 中按照以下模式绘制 Rect,而不是“左、上、右、下”?问题是我使用的是随机坐标:
Rect e = new Rect(random.nextInt(300)+20,20,random.nextInt(300)+45,70);
而且很难跟踪第一个左侧随机位置以包含在右侧的宽度中。在“x,y,w,h”中,很容易应用我的碰撞测试:
if ((((p.left+p.width())>e.left)&&(p.left<(e.left+e.width())))&&
(((p.top+p.height())>e.top)&&(p.top<(e.top+e.height())))) {
gameScreen = 2;
}
【问题讨论】:
标签: android position height width rect