Android drawRoundRect 踩坑

项目中需要画一个圆角矩形,自然想到drawRoundRect().咔咔咔一顿操作,提测.在android6.0机型居然显示不出来.但是Android7.0以上是可以显示出来的.

版本兼容问题
//Make sure that coordinates in RectF that is used to draw rounded rectangle are correct. That means: rect.left < rect.right and rect.top < rect.bottom.
//It seems that Android 7 corrects wrong coordinates itself and draws desired rounded rectangle, but Android 6 is drawing nothing if there is problem with coordinates.

故名思意,在Android 7.0,left>right ,top>bottom,不然就显示不出来,记录下!!

你可能感兴趣的:(app基础)