需要使用xml绘制模糊线条

时间:2012-09-27 15:54:39

标签: java android xml

需要使用xml绘制模糊线,而不是使用图像或位图。

enter image description here

//在xml中我只是画一条线。

如何将其作为模糊边缘

<View
        android:id="@+id/blur_divider_line"
        android:layout_width="wrap_content"
        android:layout_height="1dp"
        android:layout_marginLeft="25dp"
        android:background="@color/white"
/>

here they使用BlurMaskFilter在位图中使用模糊效果。

1 个答案:

答案 0 :(得分:3)

使用渐变颜色相同但中间颜色为实心的渐变。这将产生阴影效果。

                 <gradient 
                    android:angle="270" 
                    android:startColor="#0fff"
                    android:centerColor="#000"                        
                    android:endColor="#0fff" 
                    android:type="linear" />

请注意,开始和结束颜色应具有100%的透明度。