ListView with background image

I would like to have the image as the background of the list. There is not a single item, but for all, and which do not move when moving the list. How to do it?

+4
source share
2 answers

I would do something like this:

<RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent"> <ImageView android:layout_width="fill_parent" android:layout_height="fill_parent" android:src="@drawable/the_background_image"/> <ListView android:layout_width="fill_parent" android:layout_height="fill_parent" android:cacheColorHint="#00000000"/> </RelativeLayout> 
+13
source

I used this:

 <ListView android:id="@android:id/list" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_below="@id/lists_header" android:layout_marginLeft="6dip" android:layout_marginRight="6dip" android:divider="@drawable/list_divider" android:dividerHeight="2dip" android:cacheColorHint="@color/shopper_background" android:background="@drawable/paper_frame" /> 

Where paper_frame is portable 9.patch.

This provides a (stretched to fill ListView area) fixed background image that doesn't scroll along with the list, and may be what you are trying to do.

I want the image to stretch as the height of the list (i.e. the top and / or bottom can be on the screen if the list is long), and I'm looking for how to do this.

+1
source

Source: https://habr.com/ru/post/1341581/


All Articles