Here is my layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:orientation="vertical">
<ListView android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@android:id/list" />
<EditText android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/search" android:hint="Filter results" />
What is causing my ListView
to cover up my edit text?
Perhaps try doing:
<ListView
android:layout_height="0dp"
android:layout_weight="1"
android:layout_width="fill_parent" android:id="@android:id/list"/>
<EditText
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:id="@+id/search"
android:hint="Filter results"/>
That way your ListView
will grow to fill only unused space regardless of its own content requirements.
You can use the weight =1 and height 0dp in Listview :
As fill_parent is deprecated so use match_parent.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ListView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<EditText
android:id="@+id/search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Filter results" />
</LinearLayout>