0

I've a layout:

<LinearLayout
xmlns:tools="http://schemas.android.com/tools"
xmlns:android.support.design="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/activity_background"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity">

<ImageView
    android:layout_width="30dp"
    android:layout_height="30dp"
    android:src="@drawable/ic_content_clear_login_36dp"
    />

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:overScrollMode="never"
    android:scrollbars="none"
    >

    <LinearLayout
        android:layout_width="match_parent"
        android:orientation="vertical"
        android:layout_height="match_parent">

    <!--Activity widgets: Edittext etc all come here-->

    </LinearLayout>

</ScrollView>



</LinearLayout>

When the soft keyboard opens, the background image set in root layout (LinearLayout) resizes if android:windowSoftInputMode="stateVisible|adjustResize" is set in manifest file, or gets scrolled up if android:windowSoftInputMode="stateVisible|adjustPan"is set in manifest file.

I want the background image to to remain in its place and only make the content(Child views of root layout) scroll up.

Any guide?

Abdullah Shoaib
  • 2,065
  • 2
  • 18
  • 26

1 Answers1

0

Dont set Relative as background , add the imageview and set it background , do as below

<ImageView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:src="@drawable/mah_kewl_background"
        android:scaleType="matrix"
        />
Shivani Gupta
  • 271
  • 3
  • 12