美文网首页
如何制作一个颜色渐变的顶部背景区域

如何制作一个颜色渐变的顶部背景区域

作者: 一点墨汁 | 来源:发表于2017-06-29 20:19 被阅读19次

在列表页面,经常需要在要显示的Item的头部区域显示一个过渡的顶部背景区域,如下图区域:

QQ20170629-201822.png

1.创建 video_title_bg.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <gradient
        android:angle="90"
        android:endColor="#FF000000"
        android:startColor="#00FFFFFF" />
</shape>
  1. 在布局中使用
<View
       android:layout_width="match_parent"
       android:layout_height="60dp"
       android:alpha="0.8"
       android:background="@drawable/video_title_bg" />

相关文章

网友评论

      本文标题:如何制作一个颜色渐变的顶部背景区域

      本文链接:https://www.haomeiwen.com/subject/akevcxtx.html