7

How to create below Image type of Progress ring in my Android app. I Want to show it 10 second before my whole app is loading on device. and also I want to rotate it. like window device rotate. Any Help be appreciated. I am new to Andorid.

Image :

enter image description here

Harshad
  • 1,344
  • 1
  • 10
  • 25

5 Answers5

11

I got the perfect answer.

Using this link I found the round progress ring.

progress_bar.gif

Then I Use this code :

animation.xml

<?xml version="1.0" encoding="utf-8"?>
<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
    android:drawable="@drawable/progress_bar"
    android:pivotX="50%"
    android:pivotY="50%" />

In My main xml file.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"          android:layout_width="match_parent"
    android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">


    <ProgressBar
        android:id="@+id/progressbar1"
        android:layout_marginTop="80dp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:indeterminateDrawable="@anim/animation"/>


</RelativeLayout>

and finally output is :

enter image description here

Pankaj
  • 9,749
  • 32
  • 139
  • 283
Harshad
  • 1,344
  • 1
  • 10
  • 25
  • But with this answer you won't get this Slow-Fast-Slow-... rotation effect just like in this GIF. I would suggest you to use this GIF only and show it for your desired time (for this I believe you already have written the code) – Ankit Bansal Feb 05 '16 at 02:32
  • @AnkitBansal if you use an `AccelerateDecelerateInterpolator` it will animate with a slow-fast-slow pattern. – Xaver Kapeller Feb 05 '16 at 04:45
  • @XaverKapeller Yes, almost forgot that – Ankit Bansal Feb 05 '16 at 06:35
5

u Can use the gifView library :https://github.com/koral--/android-gif-drawable

use this is your .xml:-

<pl.droidsonroids.gif.GifImageView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:src="@drawable/src_anim"
    />

where src_anim is your loader gif file

JAAD
  • 12,349
  • 7
  • 36
  • 57
4

Modifying the resource image of Progress Bar - this question recently has been discussed here. Check it out.

In short - you can use

  • custom drawable
  • animation-list

Both approaches allows to create progress bar like yours.

Community
  • 1
  • 1
Konstantin Loginov
  • 15,802
  • 5
  • 58
  • 95
4

You can use this library to do it in a easier way. Furthermore, so many intuitive progressBar's type is available for you as well.

https://github.com/81813780/AVLoadingIndicatorView

topcbl
  • 799
  • 6
  • 20
1

Use Lottie animation. See: https://github.com/airbnb/lottie-android The LottieDrawable from library contains method progress(), which sets right frame if loaded image is progress image.

Milan Jurkulak
  • 557
  • 3
  • 6