如何制作透明渐变?
我有以下渐变:
<?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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
只需使用 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.
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...
您可以尝试以下代码:
You can try the following code :