類似Google Fit wheel chart的Android視圖:fit-chart
fit-chart是一個類似Google Fit wheel chart的Android視圖。
How to use
Configuring your project dependencies
Add the library dependency to your build.gradle file.
dependencies { ... compile 'com.txusballesteros:FitChart:1.0' }
Adding the view to your layout
Add the view to your xml layout file.
<com.txusballesteros.widgets.FitChart android:layout_width="200dp" android:layout_height="200dp" />
Styling the view
If you want to customize the view, you can set the next attributes.
<com.txusballesteros.widgets.FitChart .. app:strokeSize="10dp" app:valueStrokeColor="#ff0000" app:backStrokeColor="#00ff00" app:animationMode="overdraw" />
Setting the values
Setting the minimum and maximum values of the scale of the chart.
final FitChart fitChart = (FitChart)findViewById(R.id.fitChart); fitChart.setMinValue(0f); fitChart.setMaxValue(100f);
Setting a single progress value.
final FitChart fitChart = (FitChart)findViewById(R.id.fitChart); fitChart.setValue(80f);
Setting a some progress values.
Collection<FitChartValue> values = new ArrayList<>(); values.add(new FitChartValue(30f, 0x2d4302)); values.add(new FitChartValue(20f, 0x75a80d)); values.add(new FitChartValue(15f, 0x8fc026)); values.add(new FitChartValue(10f, 0xB5CC84)); final FitChart fitChart = (FitChart)findViewById(R.id.fitChart); fitChart.setValues(values);
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!