3

I am Developing a chat app which has background chat image and default keyboard,when i have to use background image it shrinks but when i use android:windowSoftInputMode="adjustResize" it works perfectly ,but keyboard hides edittext,if i use android:windowSoftInputMode="adjustPan" keyboard displays perfectly but image shrinks,how can i use both option on single Activity

If i use both option in manifest edittext has been hidden

enter image description here

Jaichander
  • 812
  • 2
  • 15
  • 24

2 Answers2

3

I'have had the same problem, and I solved it putting adjust settings programmatically when it's needed

this is the code:

getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);

and

getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
Ging3r
  • 2,010
  • 2
  • 17
  • 26
2

According to the documentation those cannot be combined:

android:windowSoftInputMode=["stateUnspecified", "stateUnchanged", "stateHidden", "stateAlwaysHidden", "stateVisible", "stateAlwaysVisible", "adjustUnspecified", "adjustResize", "adjustPan"]

The setting must be one of the values listed in the following table, or a combination of one "state..." value plus one "adjust..." value. Setting multiple values in either group — multiple "state..." values, for example — has undefined results. Individual values are separated by a vertical bar (|). For example:

dowi
  • 1,005
  • 15
  • 30