Before you answer, please consider that I’ve tried all the following solutions:
–How to adjust layout when soft keyboard appears
–Move layouts up when soft keyboard is shown?
–Software keyboard resizes background image on Android
In my login screen, I want to move my background image up along with the other elements. Here is the xml:
1. The desired effect is actually more like when I use
android:windowSoftInputMode="adjustPan" in my manifest’s activity. With
adjustPan, the root
RelativeLayout with the picture set as background gets nicely pushed upwards, just as I want, but everything below the focused element is cut, which I don’t want.
2. -with the above xml, setting the picture directly in
android:background="@drawable/loginpic", the picture will get squashed.
3. -when adding an
ImageView, the picture moves up, but not as much as the bottom elements, which means that said elements will be higher up on the picture
4. -when using a
ScrollView to wrap everything, putting the picture in an
ImageView will result in a wierd behaviour where we’ll be able to scroll and we’ll see a huge white part between the soft keyboard and the lowest element (login button)
5. -the best result with a
ScrollView is when setting the bitmap element as background (
android:gravity="bottom" being key). When the soft keyboard is shown, the background picture is scrolled along with the bottom elements at the same height. BUT with the bitmap, the picture is zoomed to an extreme and not recognizable anymore. The screen is NOT scrollable (as desired).
In the end, I want to know how to avoid cutting elements below the focused one when using 1. (with
adjustPan) OR how to centerCrop my picture in the bitmap xml using 5. Both would give me the desired effect.