设置新主题后,AChartEngine 不再尊重来自主题的默认背景。我做了几次尝试来解决这个问题,但都没有成功。我需要做什么?
设置来自styles.xml
:
res/values/styles.xml: <style name="AppTheme" parent="android:Theme.Holo.Light" />
res/values-v11/styles.xml: <style name="AppTheme" parent="android:Theme.Light" />
清单的一部分:
<application
...
android:theme="@style/AppTheme" >
示例代码:
XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
dataset.addSeries(timeSeries);
XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer();
renderer.setAxesColor(Color.GRAY);
renderer.setAxisTitleTextSize(16);
renderer.setChartTitle(label);
renderer.setChartTitleTextSize(20);
renderer.setGridColor(Color.GRAY);
renderer.setLabelsColor(Color.LTGRAY);
renderer.setLabelsTextSize(15);
renderer.setLegendTextSize(15);
renderer.setMargins(new int[] {
20, 30, 15, 0
});
renderer.setPointSize((float) 5.0);
renderer.setShowGrid(true);
renderer.setXLabels(10);
renderer.setXTitle(getString(R.string.txt_datum));
renderer.setYLabels(10);
renderer.setYTitle(MyPreferenceActivity.getWaehrung());
renderer.setZoomButtonsVisible(true);
int[] colors = new int[] {
Color.RED
};
PointStyle[] pointStyles = new PointStyle[] {
PointStyle.POINT
};
for (int i = 0; i < colors.length; i++) {
XYSeriesRenderer tempRenderer = new XYSeriesRenderer();
tempRenderer.setColor(colors[i]);
tempRenderer.setPointStyle(pointStyles[i]);
renderer.addSeriesRenderer(tempRenderer);
}
GraphicalView graphicalView = ChartFactory.getTimeChartView(this,
dataset, renderer, null);
layout.addView(graphicalView, new LayoutParams(LayoutParams.FILL_PARENT,
LayoutParams.FILL_PARENT));
结果图像。不正确的黑色背景从何而来?