I am developing an application in which the background image get shrink on keyboard pop-up. My .xml is as follows :
Just use in your onCreate()
this code:
protected void onCreate(Bundle savedInstanceState) {
...
getWindow().setBackgroundDrawableResource(R.drawable.your_image_resource);
...
}
and eliminate this line in your xml:
android:background="@drawable/background"
Read more at:
http://developer.android.com/reference/android/view/Window.html
Why don't you do like this
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true"
android:focusable="true"
android:background="@drawable/background"
android:focusableInTouchMode="true">
<RelativeLayout
android:id="@+id/relative"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:focusableInTouchMode="true"
/**
Other stuff
*/
>
</RelativeLayout>
</ScrollView>
I had faced the similar issue once, mine was solved by using the below properties in manifest use it where your activity is declared.
android:windowSoftInputMode="stateHidden|adjustResize|adjustPan"
i am using below view heirarchy and its working fine for me:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ScrollView
android:id="@+id/rfqItemsParentScrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
Hey can you please try adding this
android:isScrollContainer="false"
in your ScrollView. It has solved my problem once. Might help u too.
Also, add this to your activity in manifest.xml
android:windowSoftInputMode="adjustPan"
Hope it helps..!! :)
You should use the adjustResize
option for the windowSoftInputMode
setting on the Activity
in your AndroidManifest.xml
file.