-1

i need to design below type of design in android. how can i design semi circular design in circle in android

enter image description here

Latha
  • 125
  • 1
  • 2
  • 10

2 Answers2

1

Define ProgressBar like this:

<ProgressBar
    android:id="@+id/progressBar"
    style="?android:attr/progressBarStyleHorizontal"
    android:layout_width="100dp"
    android:layout_height="100dp"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    android:max="200"
    android:progress="0"
    android:progressDrawable="@drawable/circular" />

Create drawable:

circular (API Level < 21):

<shape
   android:innerRadiusRatio="2.3"
   android:shape="ring"
   android:thickness="5sp" >
   <solid android:color="@color/someColor" />
</shape>

circular (API Level >= 21):

<shape
   android:useLevel="true"
   android:innerRadiusRatio="2.3"
   android:shape="ring"
   android:thickness="5sp" >
   <solid android:color="@color/someColor" />
</shape>

useLevel is false by default in API Level 21.

Now since we have set max = 200, to achieve semi circle, range of the progress should be 0 to 100. You can play around with these values to achieve desired shape.

Thus use it like this:

ProgressBar progressBar = (Progressbar) view.findViewById(R.id.progressBar);
progressBar.setProgress(value); // 0 <= value <= 100
Rohit Arya
  • 6,751
  • 1
  • 26
  • 40
  • thank you for your reply.but i think this one is for progress bar shape , but i need do in xml file . did you seen the image which i was uploaded? – Latha Apr 11 '16 at 11:05
0

Checkout this library it may help you :

https://github.com/glomadrian/velocimeter-view.git

Ameer Faisal
  • 355
  • 1
  • 9