It's a while I am stuck with this issue. May be some one can help.
The problem is the background of my android circular progress bar has different sizes according to mobile screen sizes.
The screen shot should explain the issue.
The Blue incomplete circle is the circular progress bar(animating). It should actually run on top of the white circle. It works right only on a particular screen size.
The white circle is set as the background drawable of the progress bar.
Here are the codes. (I have put only needed code)
acivity_countdown.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:orientation="vertical"
android:background="#FD4C0D"
>
<FrameLayout
android:id="@+id/CountDownProress"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#FD4C0D"
>
<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:indeterminate="false"
android:progressDrawable="@drawable/circular_progress_bar"
android:layout_alignParentBottom="true"
android:background="@drawable/circular_shape"
android:layout_centerHorizontal="true"
android:max="500"
android:progress="0"
></ProgressBar>
<LinearLayout.../><!--this layout contains text inside circular progress -->
</FrameLayout>
<FrameLayout.../><!--this layout contains button under circular progress -->
</LinearLayout>
circular_progress_bar.xml
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="0"
android:toDegrees="0">
<shape
android:innerRadiusRatio="2.5"
android:shape="ring"
android:thickness="3dp"
android:useLevel="true">
<gradient
android:angle="0"
android:endColor="#005B7F"
android:startColor="#005B7F"
android:type="sweep"
android:useLevel="false">
</gradient>
</shape>
</rotate>
circular_shape.xml(The background drawable)
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:useLevel="false"
android:innerRadius="145dp"
android:shape="ring"
android:thickness="0.8dp"
>
<solid android:color = "#ffffff"/>
</shape>
I have tried to make the circular_shape.xml (background of progress bar) scale according to screen size according to this https://stackoverflow.com/a/9362168/3929188. But creating a bitmap xml from drawable was challenging for me that I simply couldn't do it (noobie developer).
I have tried to put background for circular_progress_bar.xml so that blue circle animation goes on top of white circle, but failed.
Any ideas are welcomed!