I have a custom image background that fills the entire screen behind a ListView.
The ListView has a header that contains some data, then a transparent 10dp margin(allowing us to see a little bit of the background image), and then some more data. Below this header, in the "body" of the ListView, I need to make the ListView's background fill all the way to the bottom of the screen even if the items within do not go all the way to the bottom.
If I set the background of the ListView, then I get the desired effect of always filling to the bottom of the screen, even with only a couple items(or none at all). But this also covers up the 10dp transparent divider in the header, so that I can no longer see the custom background "through" the header.
Can someone please point me down the right path for getting both the filling of the screen while maintaining the transparent divider inside the header?
Someone mentioned in passing that I might need to create "fake" item cells that could be used to create the illusion of a ListView background without impacting the header's transparent divider. However, I am hoping to find an easier solution if possible.. or if that is the best solution see if someone can give me some pointers on how to accomplish that in the most efficient way.
Thank you!
EDIT:
Here's how I am defining the header, although I think this question has more to do with the ListView than this header which I am adding to the ListView via addHeaderView().
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:background="@android:color/transparent" android:orientation="vertical">
<include android:id="@+view_list_header/headertop"
layout="@layout/view_list_item"/>
**<LinearLayout android:id="@+view_list_header/ll_transparent_filler"
android:layout_width="fill_parent" android:layout_height="10dp"/>**
<RelativeLayout android:id="@+view_list_header/sort" android:layout_width="fill_parent" android:layout_height="wrap_content">
<TextView.../> <ImageView.../> <TextView.../>
</RelativeLayout>
</RelativeLayout>
So, I've tried various ways of creating the 10dp filler, currently I'm using an "empty" 10dp LinearLayout so that I can obtain a reference to it and set its visibility to GONE when I want to(which I am NOT doing in the case I am discussing)
I am setting the ListView's background like this: listView.setBackgroundResource(resource).
Again, when I do set the background to this ListView, I get the desired behavior of the background always filling the entire screen, even if the number of items I have added to the list(which incidentally all use the same background resource that I am setting to the ListView) is not enough to fill the screen. But when I do this, the 10dp "transparent margin" in the header is not visible because, behind it, the ListViews background is preventing the underlying views from being seen.
I am assuming this happens because the ListView's background also goes behind the Header and Footer views.
The point is, there are lots of ways to create a 10dp "transparent margin" between elements that will allow the underlying views to show through. My problem lies in creating a background for the ListView "body"(i.e. not the Header/Footer) that always fills the screen, even when the list is partially filled or empty and at the same time preserving that transparency in the header so that I can still see the views that are "behind" the ListView.