相对布局渐变掩码android

时间:2015-02-16 09:27:58

标签: android xml relativelayout

您好我正在开发包含Twitter个人资料等个人资料的应用程序 我遇到了一个小问题。 问题是如何制作这样的渐变黑色透明蒙版效果 enter image description here

任何人都可以帮助我或提供一个代码如何使用xml来实现此效果 谢谢:)

1 个答案:

答案 0 :(得分:2)

如果我很了解你,你应该创建一个新的drawable xml,如下所示:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle" >
    <gradient
            android:startColor="#000000"
            android:centerColor="#C0C0C0"
            android:endColor="#FFFFFF"
            android:angle="90"/>
</shape>

并在视图中将其设置为背景。

相关问题