4

I have an app that runs fullscreen by using:

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);

Because of this the layout, android:windowSoftInputMode="adjustResize" is not working properly, i.e. it dose not resize.

Is there any way to get over the problem?

Mat
  • 202,337
  • 40
  • 393
  • 406
Sathya
  • 2,197
  • 4
  • 22
  • 25

2 Answers2

4

FYI: This is an existing AOSP (Android Open Source Project) bug: http://code.google.com/p/android/issues/detail?id=5497

Ideally this bug would be fixed, but until then here are a couple thoughts of how it could be worked around. Since I have no idea what application scenario this pertains to, these may not be very applicable.

  1. In agreement with my best interpretation of the previous answer, design your layout so that adjustPan works ok with it. The first thing I can think of here is not having any headers or footers that are intended to remain on screen when the keyboard is up.

  2. Don't use FLAG_FULLSCREEN with a layout that can accept text input. Possibly it wouldn't be a big deal to show the status bar when accepting input. However, for something that views content with embedded input fields (like a web browser) that has a fullscreen mode, this doesn't make much sense at all.

  3. Implement adjustResize-like behavior of your own. I'm not sure how well this would work, but possibly you could write a subclass of whichever class is causing the keyboard to be shown (ex: EditText) where you either track when the keyboard is shown or take over the calls to show and hide the keyboard (overriding at least onKeyUp and onTouchEvent). When shown, resize your content - possibly with a best guess of the softinput height, since users can install different soft input methods. I believe this would be technically difficult and not reasonable to attempt without extreme need.

Stan Kurdziel
  • 5,476
  • 1
  • 43
  • 42
  • I don't understand the downvote on this answer. Perhaps the downvoters want a little [background on adjustResize and adjustPan]:http://developer.android.com/guide/topics/manifest/activity-element.html#wsoft ? Note that adjustUnspecified is default. adjustResize is the best behavior as long as the layout is able to resize to a new dimension (IE, the screen minus the keyboard). Also note that 2 years after my initial answer, someone posted an implementation of #3 on the linked bug thread: http://stackoverflow.com/a/19494006/1241783 – Stan Kurdziel Jan 28 '14 at 18:58
3

Instead of android:windowSoftInputMode="adjustResize" you can try with android:windowSoftInputMode="adjustPan"

Niranj Patel
  • 32,980
  • 10
  • 97
  • 133
Mohammed Azharuddin Shaikh
  • 41,633
  • 14
  • 96
  • 115
  • 1
    If adjustPan is working properly, it will result in some of your activity being pushed offscreen in order to make room for the keyboard. This may work fine for some situations and not be acceptable at all for others. – Stan Kurdziel Jan 31 '14 at 23:11