如何在视图顶部创建渐变

时间:2015-10-09 18:33:53

标签: android android-background

如果您注意到视图的顶部。有一个浅梯度。

我该如何创作?

e.g。

  • 插入带渐变背景的视图?
  • 使用排序的顶部边框?

任何帮助都会很棒!

enter image description here

1 个答案:

答案 0 :(得分:1)

gradient.xml中创建/res/drawable

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