6

I have an EditText near the bottom of the activity. When i click the first time appear the Keyboard and then al the layout move up to make the EditText visible to write in it and see what you digit.

When i close the Keyboard (using DONE button) and click again in the EditText the layout does'n move and the EditText is completly covered by the Keyboard.

I tryed ScrollView and AdjustResize and AdjustPan but nothing is changed.

            <com.mypackage.widget.CEditText
                android:id="@+id/myETid"
                android:layout_width="@dimen/edittext_medium_width"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical"
                android:background="@drawable/background_edittext"
                android:gravity="center_horizontal"
                android:inputType="number"
                android:maxLength="14"
                android:padding="@dimen/activity_smargin"
                android:singleLine="true"
                android:textColor="@android:color/black"
                android:textSize="@dimen/font_midcommon_size"
                app:typeface="@string/commonFontRegular" />

This is my custom EditText (it is simply extend Standard EditText to manage the TypeFace)

    <activity
        android:name=".gui.activity.MyActivity"
        android:label="@string/activity_name"
        android:windowSoftInputMode="stateHidden|adjustPan"
        android:screenOrientation="landscape" >
    </activity>

And this is my Activity entry of the AndroidManifest.

Any Ideas?

  • 2
    did you try with `android:windowSoftInputMode="adjustPan"`? – Aitor Ramos Pajares Aug 27 '15 at 16:04
  • Yes, i tryed with android:windowSoftInputMode="adjustPan" and android:windowSoftInputMode="adjustResize". Both in Edittext xml or in the AndroidManifest but dues not resolve – Michele Cassani Aug 28 '15 at 09:19
  • 4
    @MicheleCassani were you able to find a solution for this ? I am facing the same issue and I can't seem to find a solution, THANKS – ahmad Nov 11 '15 at 10:03
  • @ahmad I am facing the same issue. Were you able to find a solution for this? – glo Jun 10 '16 at 10:21
  • for me, this happens only on certain devices, not dependent on a concrete android version, but with soft buttons on-screen – Moritz Both Jul 22 '16 at 12:20

1 Answers1

6

You set "gravity" in .xml and that is the problem. But i don't know why. It seems to be a bug of android, just remove that line.

星星瑶
  • 159
  • 2
  • 7
  • 1
    indeed this "solves" it, but now my text is no longer centered. I must admit I found this unlikely, tried it anyway, and it worked. Thanks! – Moritz Both Jul 22 '16 at 12:18
  • based on your hint I have done the following: On second use of the TextEdit set gravity to none and left padding to half of its width, so emulating the look of the centered empty text control. Added a TextListener to detect when text is entered and set grvity and padding back to the original values. This works for me, and its a giant hack – Moritz Both Jul 22 '16 at 14:36
  • weird, but effective – Nilabja Aug 05 '16 at 11:50
  • And what if we need the text to be centered? – Borja Jan 10 '17 at 08:12