Android:listview角落的背景

标签 android listview

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

enter image description here

我的 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 

关于Android:listview角落的背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11363564/

相关文章:

java - ListView 中的 Admob 广告

java - Android 中的选项卡布局和按钮

android - OrmLite Android DatabaseHelper 使用

javascript - 使用 jQuery 移动版本 1.0rc3 刷新 ListView

android - 如何在抽屉导航中为 ListView 设置自定义 EmptyView

android - 在 Android studio 项目命令 'C:\Program Files\Java\jdk1.7.0_25\bin\java.exe' 中获取错误'以非零退出值 2 完成

Android ListView - 在ListView.setOnTouchListener中获取列表中的多个元素

android - 在 Android 中按需显示上下文菜单

wpf - 从 ListView 的 ItemContainer 为 ContextMenu 设置 DataContext?

jQuery 移动 + 主干 : cannot call methods on listview prior to initialization