Rect and RectF in Android SDK

AndroidAndroid CanvasRect

Android Problem Overview


What is the difference between Rect and RectF in the Android SDK?

Android Solutions


Solution 1 - Android

Using Rect you define its edges using integers and using RectF they are defined as floats.

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

RectF

So apparently there are some differences.

Solution 2 - Android

Rect is final, RectF can be extended

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionIulius CurtView Question on Stackoverflow
Solution 1 - AndroidOctavian A. DamieanView Answer on Stackoverflow
Solution 2 - AndroidJayJayView Answer on Stackoverflow