MPAndroidChart 填充颜色渐变 [英] MPAndroidChart fill color gradient
本文介绍了MPAndroidChart 填充颜色渐变的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以使用 MPAndroidChart(或任何其他 Android 图表库)用渐变颜色填充绘制线下方的图表?像这样:
Is it possible with MPAndroidChart (or any other Android chart library) to fill the chart under the draw line with a gradient color? Something like this:
set1.setFillColor(getResources().getColor(R.drawable.chart_fill));
然后在 chart_fill.xml
中:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<gradient
android:angle="90"
android:endColor="#FF207a54"
android:startColor="#FFffffff" />
</shape>
推荐答案
好吧,我找到了解决方案:
Okay i have found a solution:
William Chart 我正在使用这种方法:
William Chart and i am using this method:
int[] colors = { getResources().getColor(R.color.menu_text),
getResources().getColor(android.R.color.white) };
float[] index = { 0, 1 };
dataset.setGradientFill(colors, index);
这篇关于MPAndroidChart 填充颜色渐变的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文