Android中Rect和RectF的区别与联系

来源:互联网 发布:mac视频剪辑软件 免费 编辑:程序博客网 时间:2024/05/29 15:53

联系:

都是用于表示坐标系中的一块矩形区域,并可以对其做一些简单操作。这块矩形区域,需要用左上和右下两个坐标点表示。
构造方法:

  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).两个类型提供的方法也不是完全一致。

0 0
原创粉丝点击