Vasant
Vasant

Reputation: 3585

how to disable image resize while if i open keyboard in device?

I am working on fragment.so in my first page image will display fine as per below.

enter image description here

after i did open second fragment and there i enter some text so, keyboard open in device.when i came back from second fragment to first fragment i seen my above image will re-sized and look like below image.

enter image description here

for image display i used dynamically height and width adjustment as square.

Code snippet:

 ViewTreeObserver vto = img_Headimage.getViewTreeObserver();
            vto.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
                public boolean onPreDraw() {
                    int Height = img_Headimage.getMeasuredHeight();
                    int Width = img_Headimage.getMeasuredWidth();
                   img_Headimage.getLayoutParams().width=Height;
                    return true;
                }
            });

hows happened this kind of issue .can anybody give idea?

Your answer would be appreciated.

Upvotes: 1

Views: 178

Answers (1)

Vasant
Vasant

Reputation: 3585

solution of above question:

set below lines in manifest current activity or fragment container activity.

android:windowSoftInputMode="adjustPan|stateAlwaysHidden"

Upvotes: 1

Related Questions