barChart.setBarColor(Color.parseColor(“#76AD4C”))
barChart.setBarColor(R.color.color_green)
Color.parseColor()和R.color.x 结果不同,和resources.getColor(R.color.x)结果一样,因getColor()过时,用ContextCompat.getColor(this, R.color.x)
如:
barChart.setBarColor(resources.getColor(R.color.color_green))
barChart.setBarColor(ContextCompat.getColor(this, R.color.color_green))
11-17
1万+
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)