Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 737
Mr.G Avatar asked May 14 '13 11:05

Mr.G


3 Answers

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

like image 125
Iftikar Urrhman Khan Avatar answered Nov 12 '22 10:11

Iftikar Urrhman Khan


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.

like image 32
Garima Mathur Avatar answered Nov 12 '22 10:11

Garima Mathur


Ok I fixed it by using

android:windowSoftInputMode="stateVisible|adjustPan"

entry inside tag in manifest file. That should work.

like image 1
goodnesskay Avatar answered Nov 12 '22 08:11

goodnesskay