2011-09-25 73 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文件。