What is the difference between Rect and RectF in the Android SDK?
在Android SDK中Rect和RectF有什么区别?
2 个解决方案
#1
41
Using Rect
you define its edges using integers and using RectF
they are defined as floats.
使用Rect可以使用整数定义它的边,使用RectF可以将它们定义为浮点数。
Looking at them more carefully I have spotted a few differences actually. I will only list what one implementation has more compared to the other one.
仔细地看他们,我发现了一些差异。我将只列出一个实现与另一个实现相比拥有更多的内容。
Rect
矩形
- equals(Object obj) (for some reason it has its own implementation of equals)
- equals(Object obj)(出于某种原因,它有自己的equals的实现)
- exactCenterX()
- exactCenterX()
- exactCenterY()
- exactCenterY()
- flattenToString()
- flattenToString()
- toShortString()
- toShortString()
- unflattenFromString(String str)
- unflattenFromString(String str)
RectF
RectF
- round(Rect dst)
- 轮(矩形dst)
- roundOut(Rect dst)
- 完成(矩形dst)
- set(Rect src)
- 集(矩形src)
So apparently there are some differences.
所以很明显有一些不同。
#2
11
Rect is final, RectF can be extended
Rect是最终的,可以扩展
#1
41
Using Rect
you define its edges using integers and using RectF
they are defined as floats.
使用Rect可以使用整数定义它的边,使用RectF可以将它们定义为浮点数。
Looking at them more carefully I have spotted a few differences actually. I will only list what one implementation has more compared to the other one.
仔细地看他们,我发现了一些差异。我将只列出一个实现与另一个实现相比拥有更多的内容。
Rect
矩形
- equals(Object obj) (for some reason it has its own implementation of equals)
- equals(Object obj)(出于某种原因,它有自己的equals的实现)
- exactCenterX()
- exactCenterX()
- exactCenterY()
- exactCenterY()
- flattenToString()
- flattenToString()
- toShortString()
- toShortString()
- unflattenFromString(String str)
- unflattenFromString(String str)
RectF
RectF
- round(Rect dst)
- 轮(矩形dst)
- roundOut(Rect dst)
- 完成(矩形dst)
- set(Rect src)
- 集(矩形src)
So apparently there are some differences.
所以很明显有一些不同。
#2
11
Rect is final, RectF can be extended
Rect是最终的,可以扩展