1

I have an EditText and a Button pinned to the bottom of a RelativeLayout.

When you click on the EditText, the soft keyboard opens, BUT the EditText and the Button disspear, but in a VERY odd way. They actually are there, because you can type, and you can also press where the Button should be just above the keyboard, and it responds to touch, but... You can't actually see them.

Not sure why, but it seems like this might be specific to screen resolution? Its broken on my NexusOne but works on my LS670. Broken on emulator with WVGA800 but works on HVGA.

I had a much more complex layout.xml but I manage to boil it down to this simple case:

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:id="@+id/test_view"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent">


        <EditText
            android:id="@+id/test_text"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentBottom="true"
            android:layout_toLeftOf="@+id/test_textButton"
            />

        <Button
            android:id="@id/test_textButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_alignParentRight="true"
            android:text="OK"/>

</RelativeLayout>

EDIT:

So the more I look into this, it appears to be a bug in the layout engine. When I click on the EditText, I can actually see the EditText animating upward before the keyboard covers it. It just doesn't make it up high enough. It appears to have something to do with the wide screen resolution. If I end up putting a margin of 100dip on the edit text, I can just barely see it poking above the keyboard, and 200dip makes it mostly show. AGAIN, this works on HVGA screens fine. The button hidden below the keyboard was still responding to my touch just above the keyboard, which was odd.

Paul
  • 181
  • 1
  • 9
  • Don't have enough points to self answer, but I found the issue: The issue was that the default softInputMode for the activity seems to have a bug in it (probably related to widesreen). If you switch it to "adjustResize" it works exactly as expect! – Paul Jan 10 '12 at 00:31

1 Answers1

0

Try setting your ScrollView to 0dp instead of fill_parent. fill_parent is causing it to fill the whole parent's height, thus overlapping test_footer.

kabuko
  • 36,028
  • 10
  • 80
  • 93
  • I re-edited my question, because I managed to boil it down to a much simpler test case. As you can see, there isn't a whole lot there. Nothing is getting hidden from a Layout perspective, because the TextView and Button ARE ACTUALLY THERE. You just can't see them. They respond to touch events where they should be viewed. – Paul Jan 09 '12 at 23:28
  • OK... same thing applies. You have an EditText which has its width set to `fill_parent`. Therefore, the width of the EditText unsurprisingly fills the width of the parent. Try replacing `fill_parent` in the layout_width attribute of the EditText with 0dp. – kabuko Jan 09 '12 at 23:36
  • I tried your change and it makes no difference. The layout of both the Button and EditText look fine before I click on the EditText. Once I click on the EditText, the softkeyboard pops up, and both the EditText and the Button "disappear", but are actually there because they respond to touch. Again, this only impacts WVGA screens too, not HVGA. Really seems like some kind of a bug in the layout rendering, rather than a mistake in my layout code. I was hoping somebody might have encountered this and has a work-around. – Paul Jan 09 '12 at 23:46