Friday, March 8, 2013

DevBytes: Request During Layout

Horrible things can result from calling requestLayout() during a layout pass. DON'T DO THIS.

The demo that I wrote to show why this is bad seems very contrived, but I have since run across application code that did nearly the exact same thing, explicitly calling requestLayout() during onLayout(). Ugh. Typically, the cases where this problem occurs are a tad more subtle than that.




Unknown said...

HI chett Hasee,hope you are fine...I know this is not relevant but i want your help,,,is this a bug that android:windowSoftInputMode="adjustResize" wont work with android:theme="@android:style/Theme.NoTitleBar.Fullscreen"


Chet Haase said...

@Raja: It's not a bug; that's actually expected behavior for a fullscreen window. However, the docs for those properties don't make that behavior obvious, so I can see where the confusion would set in. We'll fix the docs to make this result a tad more obvious.

Unknown said...

@Chet Hasse thanks alot for the response..the problem i see that in full screen mode,there is a edit text at bottom of my screen,when it gain focus the soft keyboard appears and i see the soft keyboard has alot of space to fit and the windows top area (there is my header and some buttons in it) is going out of view,what soft keyboard is doing is making the window sliding up even when their is too much space for the keyboard ot fit

But if i use android:theme="@android:style/Theme.NoTitleBar only it is woriking fine,the window is not going any where (i guess this is the right behaviour)

And i tested this scenario with default windowSoftInputMode...i think windowSoftInputMode has nothing to do with this scenario

What do you want to say about that..waiting for your kind response

Chet Haase said...

@Raja: Sorry, this isn't the right forum for answering random questions, just wanted to make sure that the behavior you described originally wasn't a bug (which it wasn't, although I am fixing the docs to make it clearer).

Unknown said...

@Chet so is there any other way i can communicate with you??