1
我在我的可繪製文件夾中有一個名爲bg.png的項目,但是它不會在我的列表視圖中顯示爲背景。我得到的只是默認的黑色。我究竟做錯了什麼?它需要是一個特定的大小,還是我的代碼中的問題?請參閱下面的main.xml:沒有出現在Android中的Listview背景
<LinearLayout android:id="@+id/LinearLayout01"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:background="@drawable/bg">
<ListView android:id="@+id/ListView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#00000000"
android:cacheColorHint="#00000000">
</ListView>
</LinearLayout>
這看起來應該可以工作,但我的猜測是ListView有一個小錯誤或什麼的。一個listview可以是一個scrollview和一個佈局容器的組合......我很難過。 –
我可以看到BG嗎?無論如何...這裏這段代碼沒有任何問題。你使用哪個SDK版本? – davidcesarino
BG是一張364×648像素的羊皮紙(大小與它有什麼關係?),最小的SDK版本是8(2.2)。 – David