I have one background image which have RelativeLayout as it's parent and sibling as ScrollView and ScrollView have one EditText. I am facing problem where background image moving top side when we are clicking Edittext. Please find below code snippet and attached screenshots. How we can restrict scrollview from doing this?
Code:
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:src="@drawable/dog"
android:scaleType="centerCrop"/>
<ScrollView
android:id="@+id/layout_scroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:visibility="visible">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<EditText
android:id="@+id/postal_code"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Postcode"
/>
</RelativeLayout>
</ScrollView>
Before:
After:
Add this in Activity Manifest
android:windowSoftInputMode="adjustNothing"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With