you need to add the flag "adjustPan" and not adjustResize
adjustResize resizes the layout, whereas adjustPan, just allows the keyboard appear over it
Frage
I have an animation in which my image goes from bottom of the screen to the top of the screen in 1 min and starts when the activity starts as follows
@Override
public void onWindowFocusChanged(boolean hasFocus){
image.getLocationOnScreen(diverSrcLoc); //bottom
View destLine = (View) findViewById(R.id.diverDest); //top
destLine.getLocationOnScreen(diverDestLoc);
destLoc[0] = srcLoc[0];
TranslateAnimation translate = new TranslateAnimation(0, destLoc[0]-srcLoc[0], 0, destLoc[1]-srcLoc[1]);
translate.setFillAfter(true);
translate.setDuration(Constants.MAX_TIME);
image.startAnimation(translate);
}
and the manifest:
<activity
android:name="com.xxx.MainActivity"
android:label="@string/app_name"
android:windowSoftInputMode="adjustResize|stateVisible" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
The problem is that when the activity starts and keyboard pops up, the animation keeps going up beyond the screen(keyboard pushing animation up). I thought the adjustReize will do it but tough luck. When you close the keyboard the animation come back to its normal path. Pop up the keyboard again and the image being animated is pushed up again.
Is there a way to solve it ?shouldn't the dest location not change with keyboard?
Lösung
you need to add the flag "adjustPan" and not adjustResize
adjustResize resizes the layout, whereas adjustPan, just allows the keyboard appear over it