measuring a view before rendering it

后端 未结 5 1150
傲寒
傲寒 2020-11-29 01:37

I need to find out how big a view will be after attaching it to its parent.

I have overridden this method:

onMeasure(int, int);

but

5条回答
  •  没有蜡笔的小新
    2020-11-29 01:58

    I'm having the same problem. I guess the only way is to render it first, then remove it after if it meets the size condition. Seems a bit of an odd way, but Android only seems to know the dimensions after drawing.

提交回复
热议问题