Android 具有背景图像的ListView
我想有一个图像作为listview的背景。 每个项目没有一个,但对于所有项目,并且不会随着listview的移动而移动。Android 具有背景图像的ListView,android,image,listview,Android,Image,Listview,我想有一个图像作为listview的背景。 每个项目没有一个,但对于所有项目,并且不会随着listview的移动而移动。 我该怎么做呢?我会这样做: <RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent"> <ImageView android:layout_width="fill_parent" andr
我该怎么做呢?我会这样做:
<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>
我用过这个:
<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" />
其中,纸框是一个9.5英寸的可拉制面片
这提供了一个(拉伸以填充ListView区域)固定的背景图像,该图像不会随列表滚动,这可能是您正在尝试做的
我想将图像拉伸到列表的高度(即,如果列表很长,顶部和/或底部可能会离开屏幕),我正在寻找如何做到这一点。我尝试为顶部元素提供背景,但它无法正常工作。这确实很有魅力。谢谢