How do I ensure that the IME show/hide results in a call to View.onSizeChanged()
I have a View
implementation whose parent layout is a ScrollView
. I would like to be called back when the IME is shown/hidden so that I can resize the View
accordingly. I understand that onSizeChanged()
should be called each time the IME is shown or hidden, but in my code this is not happening.
I've written a test application in order to get the functionality I'm after, and it contains:
- A
Button
to toggle the IME (show/hide). - A
ScrollView
containing severalTextView
s.
When I click on the button (in this test app), then the IME is shown and the ScrollView
is resized accordingly. This开发者_开发技巧 is the behaviour I want. I note that in the test app, the ScrollView
's onSizeChanged()
gets called by the framework requesting a layout, and then an invalidate()
to redraw
the screen. This behaviour is missing in my incorrectly-functioning application; there is no call to the ScrollView
's onSizeChanged()
or to my implemented View
's onSizeChanged()
.
My manifest contains the android:windowSoftInputMode="adjustResize"
attribute, and I've also added isScrollContainer="true"
to the ScrollView
's attribute in the layout xml, but this doesn't appear to make any difference.
Could someone please suggest what it is that I could look at in order to get the onSizeChanged()
callback in my View
?
Note: This is essentially a cross-post of the following on the Android-Developers group:
http://groups.google.com/group/android-developers/t/fa84d7cb450c7f5e
Apologies if this offends anyone, but by posting here (with appropriate tags) I believe that the android team will see it and hopefully provide some assistance.
The issue is that I've used the FULL_SCREEN Window flag. That flag and adjustResize are 'incompatible' it seems.
This came up in August last year:
http://groups.google.com/group/android-developers/browse_thread/thread/4f5f779d58170d20
Presumably, this is a defect and so I'll get around to raising an issue.
精彩评论