我正在使用令人惊叹的图书馆MPAndroid图表。它的工作原理就像一个魅力,除非我试图更改 BarData 的背景颜色。默认颜色是白色,我想将其更改为透明。
我试过这个:
Paint p1 = mChart.getPaint(Chart.PAINT_GRID_BACKGROUND);
p1.setColor(Color.RED);
和这个:
<com.github.mikephil.charting.charts.BarChart
android:id="@+id/chart1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent"/>
...但似乎不起作用。
有任何想法吗 ?
谢谢=)
Since 发布v1.6.5, 的背景Chart
is 默认透明。意思是,背景中的所有内容(图表背景、其他Views
等),没有被绘制到的数据覆盖Chart
,将可见。
如果您想更改背景(颜色,或者可能是可绘制的),您可以通过更改图表背景来实现
- 在 .xml 中(
android:background="..."
)
- 通过致电
setBackgroundColor(...)
or setBackgroundResource(...)
另一种方法可能是更改包含的父布局的背景Chart
.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)