How to present a keyboard and not compress the background image in a layout

I have a scroll view and inside that there is a layout. Inside this layout I included a form (mostly text fields and text fields)

When at runtime. if I click on the text box, a keyboard will appear that will be completely normal. But there is a problem that the background image has been compressed.

Is there any way to avoid this. The background image should not be reduced

+4
source share
3 answers

you need to modify the manifest file

in activity tag

android:windowSoftInputMode="adjustPan" 

add this.

see this http://developer.android.com/guide/topics/manifest/activity-element.html#wsoft

+12
source

We need to set the background to the top level view added to Window Manager

To resolve this issue, follow these steps:

1. You must set the background to the onCreate () method

 @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().setBackgroundDrawableResource(R.drawable.your_drawable_background); } 

2. Change the background from your xml

 android:background="@drawable/your_drawable_background" 

Resetting the background with a scroll view will be fully enabled.

0
source

Ok i fixed it using

Android: windowSoftInputMode = "stateVisible | adjustPan"

entry inside the tag in the manifest file. That should work.

0
source

Source: https://habr.com/ru/post/1480699/


All Articles