public void layout(int left, int top, int right, int bottom) { boolean sizeChanged = setBounds(left, top, right, bottom); mViewFlags &= ~FLAG_LAYOUT_REQUESTED; // We call onLayout no matter sizeChanged is true or not because the // orientation may change without changing the size of the View (for // example, rotate the device by 180 degrees), and we want to handle // orientation change in onLayout. onLayout(sizeChanged, left, top, right, bottom); }