安卓自定义View之带动画的饼状图
<!-- 扇形图 -->
<com.example.yanxu.piechartview.view.PieChartView
android:id="@+id/pie_chart_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
private float[] ratios = {0.1f, 0.2f, 0.3f, 0.4f};
private String[] colors = {"#FFB864", "#6F7CFF", "#884EDB", "#90E3E1"};
/**
* 初始化data
*/
private void initData() {
mPieChartView.initSrc(ratios, colors);
mPieChartView.startDraw();
}