Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Keyboard cover EditText when i click it second time

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?

like image 500
Michele Cassani Avatar asked Aug 27 '15 16:08

Michele Cassani


1 Answers

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.

like image 51
星星瑶 Avatar answered Oct 06 '22 00:10

星星瑶