android - 如何制作透明渐变?

标签 android listview transparency gradient

我有以下渐变:

<?xml version="1.0" encoding="utf-8"?>
    <shape xmlns:android="http://schemas.android.com/apk/res/android">
        <gradient 
            android:startColor="#ECECEC"
            android:centerColor="#F6F6F4"
            android:endColor="#F8F8F6"
            android:angle="90"
            android:dither="true"
         />
    </shape>

我希望它是透明的,因为在我的 ListView 中我将它设置为我的 ListSelector:

<ListView android:layout_width="fill_parent"
                android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android"
                android:id="@+id/ARListView" 
                android:background="@drawable/transparent_background" 
                android:cacheColorHint="#00000000" android:drawSelectorOnTop="true" 
                android:listSelector="@drawable/stocks_selected_gradient">
</ListView>

最佳答案

只需使用 8 位颜色值,例如#FFF8F8F6,其中前两个字符是 alpha 值。 FF 完全不透明,00 完全透明。

关于android - 如何制作透明渐变?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3823607/

相关文章:

java - IF 语句不适用于 TextWatcher

java - `listView.invalidate()` 和 `adapter.notifyDataHasChanged()` 之间有区别吗?

java - 无法使用 baseadapter 解析带有 listview 的构造函数适配器

android - 如何在使用 AsyncTask 下载图像时显示默认图像?

user-interface - 窗口Ex : setting the background color to transparent

android.database.sqlite.SQLiteException : bind or column index out of range

android - 如何在我的请求 header 中添加授权?

android - 在 Android Layout 中,我怎样才能有一个 float 图像(右对齐)和环绕图像的文本?

windows - DirectDraw + 分层窗口颜色键?

c# - 如何在 C# for iOS 中设置颜色在固定背景图像上的透明度级别?