Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Draw circle which is filled horizontally in Android

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:

Preview

like image 329
Omar Avatar asked Aug 06 '15 14:08

Omar


People also ask

How to draw a circle in Android?

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:

How to draw tick mark with circle background shape in Android?

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 circular image view in Android without using any library?

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. ...

How to draw shapes in Android framework?

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.


1 Answers

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"/>

circle

like image 120
justHooman Avatar answered Sep 21 '22 09:09

justHooman