To draw circles and pie charts in Android, we can use the AChartEngine Android framework as shown here.
However, how can we draw circles that is partly filled horizontally (or vertically) in Android? I mean circles which are filled, for example, from the bottom to the top according to the percentage specified in Java code.
Here is a preview of what we need:
To draw a circle in Android you just need to create your own View class and then use that in your Activity. For example, the following CustomView shows how to extend a View and draw a circle in the onDraw method: Now all you have to do is use this CustomView in your Activity:
This example demonstrates How to draw tick mark with circle background shape in android. Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main.xml.
How to create a Circular image view in Android without using any library? Step 1: Creating the layout of the circular image view Create a new drawable resource file in the drawable directory... Step 2: Next step is to make a layerlist drawable so that it can act as background to your imageview. ...
For instance, if you want to draw a square, you need to draw four lines. So, you need the drawing line function in your framework. On the other hand, if you want to draw a crescent, you need to draw two curves with the drawing curve function. Now, to convert that shape on your paper into a shape in Android, you need to consider its coordinates.
Try this lib Circle Progress.
Here is a sample from lib's author:
<com.github.lzyzsd.circleprogress.CircleProgress
android:id="@+id/circle_progress"
android:layout_marginLeft="50dp"
android:layout_width="100dp"
android:layout_height="100dp"
custom:circle_progress="20"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With