1

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.

Vasant
  • 3,475
  • 3
  • 19
  • 33

1 Answers1

1

solution of above question:

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

android:windowSoftInputMode="adjustPan|stateAlwaysHidden"
Vasant
  • 3,475
  • 3
  • 19
  • 33