8

I have a problem with soft keyboard overlapping parts of EditTexts.

When I click my EditTexts the soft keyboard appears just below the text, which means that a part of the text box is not shown as the soft keyboard overlaps it.

Any ideas how to increase the distance between EditText and Soft keyboard?

user1354603
  • 4,034
  • 4
  • 31
  • 43

4 Answers4

2

There will be certain Solutions available that some times works and some times not what I am using is working and will handle your scenario Use the following Step by step

1- Add Scroll view to your layout inside the main layout

2- get Its reference

3- now use the following code snippet

editTextField.setOnFocusChangeListener(new OnFocusChangeListener() {

        @Override
        public void onFocusChange(View v, boolean hasFocus) {
            // TODO Auto-generated method stub
            v.postDelayed(new Runnable() {

                @Override
                public void run() {
                    // TODO Auto-generated method stub
                    /*if(Build.VERSION.SDK.equals("4.1.1")||Build.VERSION.SDK.equals("4.1.2"))
                    {

                    }
                    else
                    {*/
                    scrollView.scrollBy(0, 150);
                    //}
                }
            }, 500);

        }
    });

when ever screen needs to adjust the overlay it will scroll up the screen

Usman Kurd
  • 7,212
  • 7
  • 57
  • 86
  • Your solution does not work for EditTexts that are located at the bottom of the screen where you cannot scroll anymore. – user1354603 Sep 06 '13 at 13:47
1

Just Try this,

Add gravity Bottom in Edit text and provide padding bottom As you need.

 <EditText
    android:gravity="bottom"
    android:paddingBottom="10dp"

    ................

   />
-1

Try this way

In your mainfest.xml

<activity
            android:name="YourActivity"
            android:windowSoftInputMode="stateHidden|adjustResize" />
Biraj Zalavadia
  • 28,348
  • 10
  • 61
  • 77
-1

The problem wasn't caused by EditText, but TextViews that messed up the layout.

user1354603
  • 4,034
  • 4
  • 31
  • 43