如何制作透明渐变?

发布于 2024-09-25 14:08:28 字数 944 浏览 1 评论 0原文

我有以下渐变:

<?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>

I have the following 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>

I want this to be transparent because in my ListView I am setting this as my 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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

喜你已久 2024-10-02 14:08:28

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

Just use an 8-digit color value, e.g. #FFF8F8F6, where the first two characters are the alpha value. FF being fully opaque, and 00 being fully transparent.

黎夕旧梦 2024-10-02 14:08:28

android:background="#00000000" android:cacheColorHint="#00000000"

这将使透明但是,这是使其完全透明......

android:background="#00000000" android:cacheColorHint="#00000000"

this will make is transparent however, this is to make it a full transparency...

困倦 2024-10-02 14:08:28

您可以尝试以下代码:

<gradient android:startColor="#hex_of_any_color" android:endColor="#00000"/>

You can try the following code :

<gradient android:startColor="#hex_of_any_color" android:endColor="#00000"/>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文