Android: LinearLayout with match_parent does not match parent

I have the following xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/filters_view_container"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:background="#ededed"
  android:orientation="vertical"
  android:paddingLeft="20dp"
  android:paddingRight="20dp" >

   <ExpandableListView
       android:id="@+id/filters_List"
       android:layout_width="match_parent"
       android:layout_height="match_parent"
       android:divider="#00000000">
   </ExpandableListView>

</LinearLayout>

LinearLayout has a gray background. I want this background to fill the entire screen (the space between the blue bar and the black bar), so I set the LinearLayout height to match_parent, but it retains the contents of the list, so I get a white space. Here's what it looks like:

enter image description here

Can anyone give me a hint on how to do this?

Thanks!

EDIT: petrumo and Tanis. 7x were almost right. Some parenting ideas did not take up all the free space. I fixed it and now all parent views occupy all the space. The first view that does not fill the gap is LinearLayout I (with identifier filters_view_container). It has android:layout_height="match_parent", so I don’t understand why it does not occupy the whole space.

LinearLayout.

enter image description here

+4
2

, , . , .

+3

xml; listview IS / , 20dp. , , 20dp right 20dp

0

All Articles