Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

when is onSizeChanged() called?

Tags:

android

Is onSizeChanged() called once the user touches some part of the screen?

I'm confused about the order in which onDraw(), onMeasure() and onSizeChanged() are called.

like image 666
iman453 Avatar asked Aug 19 '10 20:08

iman453


1 Answers

Android doesn't know the real size at start, it needs to calculate it. Once it's done, onSizeChanged() will notify you with the real size.

onSizeChanged() is called once the size as been calculated. Events don't have to come from users all the time. In this example when android change the size, onSizeChanged() is called. Same thing with onDraw(), when the view should be drawn onDraw() is called.

onMeasure() is called automatically right after a call to measure()

like image 148
Colin Hebert Avatar answered Oct 23 '22 10:10

Colin Hebert