Authorative way to override onMeasure()?

后端 未结 8 2148
眼角桃花
眼角桃花 2020-12-04 07:32

What\'s the correct way of overriding onMeasure()? I\'ve seen various approaches. For example, Professional Android Development uses MeasureSpec to calculate the di

8条回答
  •  南笙
    南笙 (楼主)
    2020-12-04 07:58

    If changing the views size inside of onMeasure all you need is the setMeasuredDimension call. If you are changing the size outside of onMeasure you need to call setLayoutParams. For instance changing the size of a text view when the text is changed.

提交回复
热议问题