Progressbar android with text inside

android, android-progressbar

Solution

You could achieve it overriding `onDraw` inside `ProgressBar`, and use `Canvas.drawText` to decide where the text should be positioned . Here you can find the documentation for drwawText:

x and y are the coordinates of the origin of the text being drawn

Problem

I have a circular `ProgressBar`, I want inside this circular bar, write the progression in percentage (like 60 %, or 70 %..) How can I do this inside the circular `ProgressBar`? ``` <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/RelativeLayout1" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <ProgressBar android:id="@+id/progressBars" android:layout_width="200dp" android:layout_height="200dp" android:layout_centerInParent="true" android:layout_centerHorizontal="true" android:layout_marginBottom="20dp" android:indeterminate="false" android:indeterminateDrawable="@drawable/progress_bar" android:max="100" /> </RelativeLayout> ```

Original source