dataset.setDrawFilled(true);
接下来,您需要为其提供渐变效果,您需要在drawable文件夹中创建一个名为gradient_chart_color的XML文件:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="90"
android:startColor="#FFF300"
android:endColor="#F5F094" />
</shape>
Drawable drawable = ContextCompat.getDrawable(this, R.drawable.fade_red);
dataset.setFillDrawable(drawable);