Mr.G
Mr.G

Reputation: 1275

How to present keyboard and not shrink background image in layout

I have a scroll view and inside that there is a layout out. Inside that layout I have included a form (basically textfields and textviews)

When in the runtime. if I press on a textfield keyboard will be appear which is tottaly normal. But there is a problem background image has been shrinked.

Is there any way to avoid it. Background image shouldn't shrink

Upvotes: 6

Views: 2846

Answers (3)

goodnesskay
goodnesskay

Reputation: 735

Ok I fixed it by using

android:windowSoftInputMode="stateVisible|adjustPan"

entry inside tag in manifest file. That should work.

Upvotes: 1

Garima Mathur
Garima Mathur

Reputation: 3352

We have to set background onto top-level view added to the Window Manager

Follow 2 steps to resolve this issue:

1.You have to set background into onCreate() method

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

2.Remove background from your xml

android:background="@drawable/your_drawable_background"

Background Shrink with Scroll View Issue would be resolved completely.

Upvotes: 1

Iftikar Urrhman Khan
Iftikar Urrhman Khan

Reputation: 1131

you have to change your manifest file

in your activity tag

android:windowSoftInputMode="adjustPan" 

add this.

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

Upvotes: 14

Related Questions