Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Software keyboard resizes background image on Android

Whenever the software keyboard appears, it resizes the background image. Refer to the screenshot below:

As you can see, the background is sort of squeezed. Anyone can shed a light on why the background resizes?

My Layout is as follows:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"     android:orientation="vertical"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:background="@drawable/page_bg"     android:isScrollContainer="false" >     <LinearLayout android:layout_height="wrap_content"         android:orientation="horizontal"         android:layout_width="fill_parent"     >         <EditText android:id="@+id/CatName"             android:layout_width="fill_parent"             android:layout_height="wrap_content"             android:layout_weight="1"             android:inputType="textCapSentences"             android:lines="1"         />         <Button android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:text="@string/save"             android:onClick="saveCat"         />     </LinearLayout>     <ImageButton         android:id="@+id/add_totalk"         android:layout_height="wrap_content"         android:layout_width="wrap_content"         android:background="@null"         android:src="@drawable/add_small"         android:scaleType="center"         android:onClick="createToTalk"         android:layout_marginTop="5dp"     /> </LinearLayout> 
like image 267
Andreas Wong Avatar asked Nov 26 '10 17:11

Andreas Wong


1 Answers

Ok I fixed it by using

android:windowSoftInputMode="stateVisible|adjustPan" 

entry inside <Activity > tag in manifest file. I think it was caused by having ScrollView inside the Activity.

like image 97
Andreas Wong Avatar answered Oct 07 '22 14:10

Andreas Wong