I have this layout
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/viewer_top"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/background_dark"
android:orientation="horizontal" >
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="3dp"
android:layout_weight="1" >
<EditText
android:id="@+id/viewer_filter"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/hint_filter"
android:background="@android:color/white"
android:drawableLeft="@android:drawable/ic_menu_search"
android:inputType="text"
android:paddingLeft="4dp"
android:selectAllOnFocus="true" >
</EditText>
<ImageView
android:id="@+id/viewer_filterX"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@id/viewer_filter"
android:layout_alignRight="@id/viewer_filter"
android:src="@android:drawable/ic_menu_close_clear_cancel"
android:visibility="invisible" >
</ImageView>
</RelativeLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_marginTop="3dp"
android:layout_marginBottom="5dp"
android:layout_weight="1" >
<EditText
android:id="@+id/viewer_search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/hint_search"
android:background="@android:color/white"
android:drawableLeft="@android:drawable/ic_menu_search"
android:inputType="text"
android:paddingLeft="4dp"
android:selectAllOnFocus="true" >
</EditText>
<ImageView
android:id="@+id/viewer_searchGo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@id/viewer_search"
android:layout_alignRight="@id/viewer_search"
android:src="@android:drawable/ic_menu_send"
android:visibility="invisible" >
</ImageView>
<ImageView
android:id="@+id/viewer_searchX"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@id/viewer_search"
android:layout_toLeftOf="@id/viewer_searchGo"
android:src="@android:drawable/ic_menu_close_clear_cancel"
android:visibility="invisible" >
</ImageView>
</RelativeLayout>
</LinearLayout>
<HorizontalScrollView
android:id="@+id/viewer_hscroll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/viewer_top" >
<ListView
android:id="@+id/viewer_list"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</ListView>
</HorizontalScrollView>
</RelativeLayout>
When I click on either EditText it expands to this dialog:
On portrait mode the EditTexts can be edited as they are without expanding. The XML for portrait is similar, only the EditTexts are one below the other and are screen wide.
How do I prevent this EditText expansion?
Not only the full phone screen is hidden by the EditText + virtual keyboard, but the clickable images the I put over the EditText are not visible.
Update
I removed the layout-land XML and used the same XML for both portrait and landscape.
In portrait mode it is fine, no expansion, in landscape mode there is expansion.
So it has to do somehow with being in landscape mode.
add this line to your edit text
android:imeOptions="flagNoFullscreen"
edit text look like this
<EditText
android:id="@+id/viewer_filter"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="hint_filter"
android:background="@android:color/white"
android:drawableLeft="@android:drawable/ic_menu_search"
android:inputType="text"
android:paddingLeft="4dp"
android:selectAllOnFocus="true"
android:imeOptions="flagNoFullscreen">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With