I have a simple user interface: an EditText should be located below a SurfaceView. I use a RelativeLayout to arrange these two views.
Now, when I tap on the EditText to open the virtual keyboard the SurfaceView slides up but the EditText is hidden and does not show the typed string.
To reproduce, use the following layout XML code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout01"
android:layout_height="fill_parent"
android:layout_width="fill_parent">
<SurfaceView
android:id="@+id/SurfaceView01"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</SurfaceView>
<EditText
android:id="@+id/EditText01"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:selectAllOnFocus="true"
android:textStyle="normal"
android:singleLine="true">
</EditText>
</RelativeLayout>
The main Activity class only needs to show the layout. When I start the program and tap the EditText, the virtual keyboard appears but the EditText field is gone.
Maybe the RelativeLayout is causing the problems, but I don't know how to reproduce the same layout with another Layout class.
Any suggestions are welcome, I really appreciate your help.
Thanks.
Edit:
Here are two screenshots, one showing the EditText at the bottom without virtual keyboard, one with virtual keyboard but with no EditText. It is interesting to note that the SurfaceView and the EditText actually shift upward, the EditText just disappears. BTW this also happens to a button if it is next to the EditText.
EditText below a SurfaceView (left); EditText is gone (right)