4

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>

The LinearLayout has a gray background. I want this background to fill the whole screen (the space between the blue bar and the black bar), so I set the height of the LinearLayout to match_parent, but it keeps wrapping the list that contents, so I get a white gap. Here is how it looks like:

enter image description here

Anybody could give me a hint about how to make this?

Thanks!

EDIT: petrumo and Tanis.7x were almost right. Some parent views wasn't taking all the available space. I fixed it, and now all the parent views are taking all the space. The first view that isn't filling the space is the LinearLayout I posted (with ID filters_view_container). It has android:layout_height="match_parent" so I don't understand why is not taking all the space.

I am adding a snapshot of the hierarchy viewer with this LinearLayout selected.

enter image description here

mario595
  • 3,671
  • 7
  • 34
  • 57
  • Have you checked DDMS' hierarchy viewer to make sure that it indeed is not matching the parent? It looks like the ListView should be taking up that extra space, so a footer view or overscroll footer color might be taking up the remaining space (see http://stackoverflow.com/a/7623153/1253844). – Bryan Herbst Nov 11 '13 at 14:49

2 Answers2

3

Probably the problem is one level higher, the previous View is not taking the entire space. If you post more layout code I can give more hints.

petrumo
  • 1,116
  • 9
  • 18
  • Almost. I took a look at the hierarchy viewer and some parent views wasn't taking all the available space. I fixed that, but linearLayout isn't taking all the space despite it has height:match_parent. I edited the question. – mario595 Nov 11 '13 at 15:33
  • Try to figure out where the chain of views stops taking the full view and fix it as well, or if the LinearList is the last one, try with fill_parent or to move the bg one level higher. – petrumo Nov 11 '13 at 15:43
  • Thanks, I've moved the background to the next upper level and now it shows as I wanted. I am still confused about why the linearLayout is not taking all the space, so if somebody has any ideas, please, share it with the classroom. – mario595 Nov 11 '13 at 15:48
0

you didnt post your edit text xml; anyways the listview IS filling/matching the parent, but your root view specified left and right padding of 20dp. So it filled the root layout where the root layout has left 20dp and right 20dp

user3148156
  • 168
  • 1
  • 1
  • 13