You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CONTRACT: When overriding this method, you must call setMeasuredDimension(int, int) to store the measured width and height of this view. Failure to do so will trigger an IllegalStateException, thrown by measure(int, int). Calling the superclass' onMeasure(int, int) is a valid use.
Activity
979451341 commentedon Dec 25, 2019
onMeasure是用于测量view的大小,但是你直接修改了,你想要这个view大小是如此,那你为何还要去重新测量呢?
你也说了是自定义View不是VIewGroup,所以你无需考虑重新计算它的子view的大小
vejei commentedon Feb 10, 2021
作者的话其实存在误导,你看官方文档就清楚了: