Android开发中用到渐变色背景场景很多也很容易实现。在res/drawable目录下添加一个xml文件(命名不限)里面的内容大体如下
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:startColor="#FFFFFF”
android:endColor="#00FFF0"
android:angle="45" />
</shape>
然后在View控件上引用这个drawable作为背景就可以了
但是如果我们在在自定义View控件上想让我们的画笔颜色做到上浅下深之类的效果,又应该如果实现呢?paint可以调用