我正在使用achartengine来显示我的应用程序中的折线图.我需要为图表添加bg图像,但是当我在xml中设置bg图像时,它不起作用.有人试过吗?提前致谢.
解决方法
首先,您需要在活动中添加图表,并在活动布局中将首选图像设置为背景. (看看AChartEngineneDemo中的XYChartBuilder,看看如何做到这一点)
其次,为图表和图表边距设置透明背景:
mRenderer.setApplyBackgroundColor(true); mRenderer.setBackgroundColor(Color.TRANSPARENT); mRenderer.setMarginsColor(getResources().getColor(R.color.transparent_background));
最后,创建自己的透明背景,因为Color.TRANSPARENT不适用于图表边距:
<color name="transparent_background">#00FF0000</color>
希望这可以帮助 :)