android-discuss icon indicating copy to clipboard operation
android-discuss copied to clipboard

[问答]自定义View时onMeasure的误差怎么办?

Open DawnYu9 opened this issue 8 years ago • 1 comments

setMeasuredDimension参数是in型 但是我自己计算的view的size是float型,四舍五入成int后显示的有一点点误差 应该怎么解决呢?

DawnYu9 avatar Dec 23 '17 09:12 DawnYu9

过去好久了, 你可以在计算过程最前面加上 "1.0 * ", 这样误差会小一点

veev520 avatar May 31 '18 04:05 veev520