Keyboard hides Edittext

Asked

Viewed 2,310 times

4

I have an activity with a EditText to enter values. Whenever the keyboard appears, the editText (the keyboard hides the EditText).

I tried to put in the Manifest in the relevant activity the following command:

android:windowSoftInputMode="adjustPan|adjustResize" 

However the keyboard when it appears continues to hide the EditText and I can’t see what’s written. The EditText is this:

<EditText android:id="@+id/EditTextMeta1"
                android:layout_height="70dp"
                android:background="@drawable/edit_text_plafond2"
                android:textSize="14dp"
                android:paddingTop="30dp"
                android:inputType="number"
                android:layout_width="60dp"
                android:gravity="right"
                android:maxLength="4"/>

Anyone can help?

  • 2

    You tried to put inside ScrollView?

  • @Rodolfo only works if you’re inside a Scrollview?

  • 1

    I think so, because with ScrollView has as you see the EditText

  • @porthfind try to remove android:windowSoftInputMode="adjustPan|adjustResize" from your manifesto and try again. I tested here and it worked (PS: I’m not using ScrollView)

  • @sicachester, works the first time I try to write, if for some reason I put the cursor to rewrite no longer scrolls "the screen", this is not normal because no?

  • You do not have a screenshot, or the code of the entire layout?

Show 1 more comment

3 answers

2

I had a very similar problem and managed to solve, if you want to use as reference:

Space between Edittext and keyboard on android

Try using in your manifest 'adjustResize|stateAlwaysHidden' and put 'android:layout_marginBottom' in edittext

0

You have to use it that way

<ScrolView
    android:id="@+id/scroll"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <EditText android:id="@+id/EditTextMeta1"
        android:layout_height="70dp"
        android:background="@drawable/edit_text_plafond2"
        android:textSize="14dp"
        android:paddingTop="30dp"
        android:inputType="number"
        android:layout_width="60dp"
        android:gravity="right"
        android:maxLength="4"/> 
</ScrolView>
  • It didn’t work. The behavior I want is that when the keyboard appears Edittext is moved up and q changed with the scrollview was that the "screen" area of the keyboard was empty even before I wanted to write in Edittext.. (I don’t know if I made myself clear)

  • 2

    @sicachester can you help me, once again, in this situation? Please!

  • Well if nothing works, try using this class, Androidbug5497workaround. (http://stackoverflow.com/questions/24529107/adjust-webview-when-keyboard-is-opened-in-android)

0

Try it like this:

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="number"
        android:maxLength="4"
        android:layout_gravity="center"
        android:paddingTop="30dp" />
</ScrollView>

It worked for me!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.