我使用折线图 (MPCharts) 渐变填充与 API 级别 19 完美配合,但不适用于 API 级别 16(我猜是下面的)。这是一个错误还是我必须以不同的方式尝试?
谢谢。
我使用了这些代码。
LineDataSet set1 = new LineDataSet(yVals, "Close");
Drawable drawable = ContextCompat.getDrawable(getApplication(),R.drawable.gradiant);
drawable.setAlpha(200);
set1.setFillDrawable(drawable);
set1.setDrawFilled(true);
屏幕截图,
最佳答案
set1.setDrawFilled(true);
if (Utils.getSDKInt() >= 18) {
// fill drawable only supported on api level 18 and above
Drawable drawable = ContextCompat.getDrawable(this, R.drawable.gradiant);
set1.setFillDrawable(drawable);
}
else {
set1.setFillColor(Color.BLACK);
}
关于android - MPCharts - 折线图(渐变填充)在 API 级别 16 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35910342/