4
我想有一個圖像作爲listview的背景。 每個項目都沒有人,但是對於所有人來說,並且不會隨着列表視圖的移動而移動。 我該怎麼做?ListView與背景圖像
我想有一個圖像作爲listview的背景。 每個項目都沒有人,但是對於所有人來說,並且不會隨着列表視圖的移動而移動。 我該怎麼做?ListView與背景圖像
我會做這樣的事情:
<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" />
凡paper_frame是9.patch繪製。
這提供了一個(拉伸以填充ListView區域)固定的背景圖像,不會隨列表一起滾動,而可能是您正在嘗試執行的操作。
我想要圖像拉伸到列表的高度(即如果列表很長,頂部和/或底部可以離開屏幕),並且正在尋找如何做到這一點。
我嘗試給頂部元素一個背景,但它只是沒有正常工作。這做了魅力。謝謝 – Warpzit 2011-11-21 11:41:07