Search code examples
androidandroid-actionbarandroid-scrollviewandroid-keypad

Android: Layout collapse when soft keypad comes and action bar is also moving


I've created registration screen with scrollview contains edittext and actionbar. When keypad opens layout getshrink for that i used adjustPan and adjustResize in androidmanifest file.

AndroidManifest.xml

<activity android:name=".UserRegistration"
        android:windowSoftInputMode="adjustPan|adjustResize">
</activity>

And i used android:isScrollContainer="false" in scrollview.

UserRegistration.xml

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillViewport="true"
    android:isScrollContainer="false">
  ....
</ScrollView>


EditText edtPhoneNo = (EditText)findViewById(R.id.mobileno);
edtPhoneNo.setOnTouchListener(new View.OnTouchListener() {
        public boolean onTouch(View arg0, MotionEvent arg1) {
            edtPhoneNo.bringToFront();
            edtPhoneNo.invalidate();
            return false;
        }
});

Action bar should not be move when keypad opens and layout should not collapse.

Can anyone helps me to solve this issue

Thanks in advance


Solution

  • This worked for me:

    <activity android:name=".UserRegistration"
            android:windowSoftInputMode="adjustNothing">
    </activity>