如何制作透明渐变? [英] How to make transparent gradient?

查看:79
本文介绍了如何制作透明渐变?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下渐变:

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

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>

推荐答案

只需使用8位数字的颜色值,例如#FFF8F8F6,其中前两个字符为字母值. 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.

这篇关于如何制作透明渐变?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆