联系:
都是用于表示坐标系中的一块矩形区域,并可以对其做一些简单操作。这块矩形区域,需要用左上和右下两个坐标点表示。
构造方法:
public RectF(float left, float top, float right, float bottom) {
this.left = left;
this.top = top;
this.right = right;
this.bottom = bottom;
}
public Rect(int left, int top, int right, int bottom) {
this.left = left;
this.top = top;
this.right = right;
this.bottom = bottom;
}
区别:
(1).精度不一样。Rect是使用int类型作为数值,RectF是使用float类型作为数值。
(2).两个类型提供的方法也不是完全一致。