[英]Android Gradient Background that fades in to being Transparent
我试图使一个栏淡入我的RelativeLayout的背景。 基本上从背面开始,然后逐渐消失为透明。 你明白了。
这是我现在拥有的xml:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient android:startColor="@color/black_translucent"
android:endColor="#323232"
android:angle="90"
android:type="linear"
android:useLevel="true"
/>
</shape>
我将视图应用于:
<View
android:layout_width="fill_parent"
android:layout_height="40dp"
android:background="@drawable/gradient_top" />
问题 :视图在底部有一个尖锐的结束边缘。 我很困惑,因为渐变以透明结尾。 但是,我仍然在视图底部看到一条鲨鱼边缘。 我该如何调整才能获得渐弱的边缘?
您的颜色都不是透明的。
@color/black_translucent
表示它是半透明的,不是透明的。
您可以改用@android:color/transparent
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.