问题
I would like to convert from a RectF to a Rect in Android. Currently I have:
RectF rectF = new RectF();
rectF.set( ... some values ... );
...
Rect rect = new Rect((int)rectF.left,
(int)rectF.top,
(int)rectF.right,
(int)rectF.bottom));
Is there a better way?
回答1:
Ah ha -- found the answer:
rectF.round(rect);
-- or --
rectF.roundOut(rect);
来源:https://stackoverflow.com/questions/16449145/what-is-the-best-way-to-convert-from-a-rectf-to-a-rect-in-android