1

Hi I am stuck with an issue and need some expert suggestions. I have a custom circular progress par whose boundary rotates as an animating light in my splash screen

It looks like this:

enter image description here

The boundary light continuously rotates till splash screen is there.

Now my splash screen has a background image which has a circle drawing at upper half of image:

It looks like this:

enter image description here

Now my circular progress bar should fit on that background circle boundary. What ever i do, it fails for some phone screens (circle is misplaced).

How can i fit into background circle and it can work on all phones and tablets.

Please let me know if further clarification is needed.

This is how I have defined circular progressbar:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">


     <ImageView
        android:id="@+id/my_splash_screen"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:src="@drawable/splashscreen" /> 


   <ProgressBar
       android:id="@+id/progress"
       style="?android:attr/progressBarStyleLarge"
       android:layout_width="170dp"
       android:layout_height="170dp"
       android:layout_centerHorizontal="true"
       android:layout_centerVertical="true"

       android:indeterminateDrawable="@drawable/my_progress_indeterminate"
       android:visibility="visible"/> 

</RelativeLayout>
Sushil
  • 8,250
  • 3
  • 39
  • 71

3 Answers3

0

I think you need to change the style attribute and set your android:layout_width="match_parent". The problem is you are setting the style to large which by default has its size pre-defined. Further in your width and height attribute you are trying to resize it. So this might be the problem.

Zax
  • 2,870
  • 7
  • 52
  • 76
  • I tried setting it to match parent but then it does not fit background circle boundary. This code is from one of my layout files for xhdpi screens. I tried to hardcode for different screen resolution but still it misfits for some screens. – Sushil Aug 14 '13 at 05:21
0

Try out with the HoloCircular ProgressBar is a Custom View implementation for Android.

Checkout the HoloCircular ProgressBar which might help you.

Other Library that you can use are as below:

1) Progress Wheel

2) ProgressBar

3) Customize the Spinner

Thanks.

GrIsHu
  • 29,068
  • 10
  • 64
  • 102
  • Thanks for your answer but I dont think progressbar is my problem. Problem is setting its size so that it fits background circle boundary for all screens. – Sushil Aug 14 '13 at 05:42
  • Try using the `FrameLayout` in your layout file. – GrIsHu Aug 14 '13 at 05:49
0

This link helped me resolve the issue to some extent as it now suppots majority of devices. Still I could get a general solution to the problem. But I can consider this as answer:

Application Skeleton to support multiple screen

Community
  • 1
  • 1
Sushil
  • 8,250
  • 3
  • 39
  • 71