Reputation: 3585
I am working on fragment.so in my first page image will display fine as per below.
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.
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
Reputation: 3585
solution of above question:
set below lines in manifest current activity or fragment container activity.
android:windowSoftInputMode="adjustPan|stateAlwaysHidden"
Upvotes: 1