0
我在HorizontalScrollView
內動態生成餅圖。當我這樣做時,餅圖的標題默認設置爲白色。如何在沒有XML的情況下更改它(因爲我沒有XML)。以下是我用來動態生成圖表的代碼。在不使用xml的androidplot餅圖中更改標題顏色
LinearLayout l_layout=chart_container;
LinearLayout.LayoutParams lp_view = new LinearLayout.LayoutParams(300,300);
PieChart pie = new PieChart(this,"BYE");
s1 = new Segment("s1", 10000);
s1.setTitle("10000");
s2 = new Segment("s2", 5000);
s2.setTitle("5000");
SegmentFormatter sf1 = new SegmentFormatter(getApplicationContext(), R.xml.pie_segment_formatter1);
sf1.getOuterEdgePaint().setColor(Color.TRANSPARENT);
SegmentFormatter sf2 = new SegmentFormatter(getApplicationContext(), R.xml.pie_segment_formatter2
sf2.getOuterEdgePaint().setColor(Color.TRANSPARENT);
pie.addSeries(s1, sf1);
pie.addSeries(s2, sf2);
pie.getBorderPaint().setColor(Color.TRANSPARENT);
pie.getBackgroundPaint().setColor(Color.TRANSPARENT);
pie.getRenderer(PieRenderer.class).setDonutSize(0.1f,PieRenderer.DonutMode.PERCENT);
pie.redraw();
l_layout.addView(pie, lp_view);
setupIntroAnimation(pie);