2011-09-25 72 views
2

我有一個問題,我知道答案很正常,但我已經嘗試了一切,但我無法弄清楚我做錯了什麼。在項目中,我已經得到了以下佈局: main.xml中Android - Listview背景問題

<?xml version="1.0" encoding="utf-8"?> 
<TabHost xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@android:id/tabhost" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent"> 
    <RelativeLayout 
     android:orientation="vertical" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:padding="3dp"> 
     <FrameLayout 
      android:id="@android:id/tabcontent" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:layout_weight="1"/> 
     <TabWidget 
      android:id="@android:id/tabs" 
      android:background="@layout/customtabshape" 
      android:layout_width="fill_parent" 
      android:layout_height="80px" 
      android:layout_alignBottom = "@android:id/tabcontent" 
      /> 
    </RelativeLayout> 
</TabHost> 

nyheder.xml

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" android:layout_marginBottom="80px"> 
    <ImageView android:id="@+id/imageView1" android:layout_height="wrap_content" android:src="@drawable/tv2sport" android:layout_width="fill_parent"></ImageView> 
<TextView 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:id="@+id/feedtitle" /> 
<TextView 
    android:layout_width="0px" 
    android:layout_height="0px" 
    android:id="@+id/feeddescribtion"/> 
<TextView 
    android:layout_width="0px" 
    android:layout_height="0px" 
    android:id="@+id/feedpubdate"/> 
<TextView 
    android:layout_width="0px" 
    android:layout_height="0px" 
    android:autoLink="web" 
    android:id="@+id/feedlink"/> 
<ListView 
    android:id="@android:id/list" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"/> 
</LinearLayout> 

row.xml

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:orientation="vertical"> 
<TextView 
    android:id="@+id/listtitle" 
    android:textSize="24px" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"/> 
<TextView 
    android:id="@+id/listpubdate" 
    android:textSize="20px" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"/> 
</LinearLayout> 

rsslist.xml

<?xml version="1.0" encoding="utf-8"?> 
<TextView 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/rowtext" 
    android:layout_width="fill_parent" 
    android:layout_height="25px" 
    android:textSize="10sp"/> 

我的問題是,我無處不在想要相同的背景紋理。我可以在任何地方,但列表本身。

根據這篇文章 http://developer.android.com/resources/articles/listview-backgrounds.html

和多個其他人,我應該能夠解決我的列表中的黑色背景的問題,通過採用了android:cacheColorHint =「#00000000」的名單內。但我幾乎試圖將這條線路放在任何地方,列表中的背景仍然是黑色的。 我在做什麼錯? (我知道現在沒有背景,我這樣做並不是爲了讓事情更復雜)。

+0

你想在標籤中放置同樣的背景嗎..? –

+0

如果您爲根線性佈局設置背景並將列表視圖的背景和行背景設置爲'#00000000',那麼它可能有效,並且您將擁有整個活動的背景。 –

+0

@Lalit Poptani 沒有在標籤中使用speciel .xml,這不會造成麻煩。我無法獲得列表中的背景。在其他地方它工作。 – Kano

回答

0

你需要再補充

android:scrollingCache="false" 

ListView中的XML文件。