Android:listview角落的背景

Android:listview角落的背景,android,listview,Android,Listview,我有圆角的listview。如何设置这些角的背景?我需要将它们设置为灰色,就像主背景一样,但它们是白色的 我的列表视图 <ListView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/cats_list" android:layout_width="fill_parent" android:layout_hei

我有圆角的listview。如何设置这些角的背景?我需要将它们设置为灰色,就像主背景一样,但它们是白色的

我的列表视图

<ListView xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/cats_list"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:cacheColorHint="#000"
            android:background="@drawable/round_corners"
            />

round_corners.xml:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
    <corners android:bottomRightRadius="7dp" android:bottomLeftRadius="7dp" 
     android:topLeftRadius="17dp" android:topRightRadius="17dp"/> 

    <gradient
        android:angle="180"
        android:endColor="#ff0000"
        android:startColor="#ff0000"
        android:type="linear" />

</shape>

是否可以将xml形状的背景设置为透明? 您可以使用系统默认设置

@android:color/transparent 

是否可以将xml形状的背景设置为透明? 您可以使用系统默认设置

@android:color/transparent 

在添加ListView之前,尝试以下添加视图的技巧。 该视图的背景色为灰色

<View
        android:background="@android:color/darker_gray"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        />

<ListView xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/cats_list"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:cacheColorHint="#000"
            android:background="@drawable/round_corners"
            />


我检查了它,它运行正常。

尝试在添加ListView之前添加视图的技巧。 该视图的背景色为灰色

<View
        android:background="@android:color/darker_gray"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        />

<ListView xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/cats_list"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:cacheColorHint="#000"
            android:background="@drawable/round_corners"
            />


我检查了它,它正常工作。

您是否签入了设备或模拟器?此快照来自模拟器模拟器模拟器不会显示转换框。我相信这是一个图形布局。抱歉,但我不理解您这里有3个蓝点@top它不会显示在emulator中,它只会在选择listview时显示在图形布局中。您是否签入了设备或emulator?此快照来自emulator emulator不会显示转换框。我相信这是一个图形布局。对不起,但我不理解你这里有3个蓝点@top它不会在emulator中显示它只会在选择listview时显示在图形布局中。shapeOk中没有背景属性。你能试着在第一个位置加上吗。但是不要使用000000而使用灰色阴影?谢谢,解决了,我在另一个布局中设置了此listview bg tranparent,对不起,傻瓜搞错了shapeOk中没有背景属性。你能试着在第一个位置加上吗。但是用你的灰色阴影代替000000?谢谢,解决了,我在另一个布局中设置了这个listview,bg tranparent,对不起,愚蠢的错误