Android line loading animation - android

How can I make an animation in Android like this one or similar?
I don't know where to start, how to make the lines and how to make them move.
See the progress bar displayed on this site: http://tinyurl.com/oqy8zef

This is an indeterminate progress bar
<ProgressBar
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:indeterminate="true" />
But you should not include "Loading..." text according to guidelines

Related

Is there any way to customize a progressbar like this (start with a circle and then a rectangle body)

I am working on an android app, which needs to show a custom progress bar like the image below. To customize a progress bar need to use android:progressDrawable, so maybe need a drawable(self-defined shape). However, I don't know if is it possible using shape to do it?
I think you better use seekbar. in seekbar widget you can change android:progressDrawable that means the rectangle area and also change android:thumb that means circle shape. But remeber you must implement custom seekbar that disabled user interaction.
I solved this problem by using FrameLayout to overlay a progress bar and a circle imageView. It works perfectly.
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ProgressBar
android:id="#+id/tagGoal_title_progressbar"
android:layout_width="match_parent"
android:layout_height="10dp"
android:layout_gravity="center_horizontal|center_vertical"
style="?android:attr/progressBarStyleHorizontal"
android:progressDrawable="#drawable/progressbar_color"
android:progress="25"/>
<ImageView
android:id="#+id/tagGoal_circle_progressbar"
android:layout_gravity="center_vertical"
android:layout_width="20dp"
android:layout_height="20dp"
android:background="#drawable/bg_progress_circle"/>
</FrameLayout>

How to make dynamic ring progress bar in android?

I want to create circular progress bar that shows progress of file uploading and downloading as whats app shows. I have seen number or libraries available on github. I do know this question has been asked and I have gone through those as well as mentioned in below link.
https://github.com/lzyzsd/CircleProgress
https://stackoverflow.com/questions/37238185/how-to-create-a-circularprogressbar-like-whatsapp-during-image-uploading
But above links refer to library. Is there any way to create circular progress bar without using any library?
In one of the link over stackoverflow I found below code
ObjectAnimator animation = ObjectAnimator.ofInt (progressBar, "progress", 0, 500);
animation.setDuration (5000);
animation.setInterpolator (new DecelerateInterpolator());
But above code does not set progress dynamically. Means that progress bar works for 5 seconds. It is not mandatory that progress bar should always run for 5 seconds. File size can be vary so is progress bar. My question is how Can I make circular progress bar dynamically without using library?
use this link to dynamically create circular progress bar How to Create a circular progressbar in Android which rotates on it? or How to create circular ProgressBar in android?
You can do that by following way when image view holds from server it hides progress bar until file loads from sever the progress bar rotates.
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ProgressBar
android:id="#+id/progress"
android:visibility="visible"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxHeight="55dip"
android:minHeight="35dip"
android:minWidth="55dip"
android:maxWidth="10dip"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true" />
<ImageView
android:id="#+id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="visible"/>
</RelativeLayout>
Hope this will help you
layout Xml
<ProgressBar
android:id="#+id/progressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:max="500"
android:progress="0"
android:progressDrawable="#drawable/circular" />
Now create the drawable in your resources with the following shape. Play with the radius (you can use innerRadius instead of innerRadiusRatio) and thickness values.
<shape
android:innerRadiusRatio="2.3"
android:shape="ring"
android:thickness="3.8sp" >
<solid android:color="#color/yourColor" />
1.use this library may be it help you out:
https://github.com/CardinalNow/Android-CircleProgressIndicator
you can also try this one:
Show Progress bar while downloading

How to create circle progressBar on Android Wear

How can i create circle progress bar on wear border like on video(1:30)? This is built-in widget or custom? I didn't find any information about this.
screen from video
Checkout the DelayedConfirmationView from wearable support library.
If you scroll down about half way through this page you'll see the XAML for the Circular Progress Bar:
https://developer.android.com/reference/android/widget/ProgressBar.html
<ProgressBar
android:id="#+id/indeterminateBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
The IndeterminateBar is default to Circle as it's undefined the actual 'Progress'

ProgressBar in android like ubuntu or mac

I want to build a horizontal progress bar with a progress animation like this:
http://www.sapdesignguild.org/community/images/progress_bar_en_lt1m.gif
My problem is that I'm not sure about how to set a horizontal-translate animation on the progress bar, like in mac or ubuntu progress bar. Right now, all I am able to get is a static image. This is my progress bar declaration:
<ProgressBar
android:id="#+id/pgBar2"
android:layout_width="fill_parent"
android:max="100"
android:indeterminate="true"
android:indeterminateBehavior="repeat"
android:indeterminateDrawable="#drawable/image2"
android:indeterminateOnly="false"
style="#android:style/Widget.ProgressBar.Horizontal/>
How can I get this kind of animation? thanks!

How to show a Horizontal Android Indeterminate Progress Bar

How to show an indeterminate horizontal progress bar in android? The animation of the progress bar should start from 0 to 100 and then go back from 100 to 0 continuously. I am not looking for the wheel progress bar.
I already knew that setIndeterminate will give an infinite horizontal progress bar. But it will be similar to the loading wheel, except that it will be horizontal. If you see my question I was looking for horizontal bar which starts from 0 and goes all the way to 100 (a gradual increase). If you want to achieve this in Android, you must use your progress bar as below:
<ProgressBar
android:id="#+id/progress_horizontal"
android:indeterminateOnly="false"
android:indeterminateDrawable="#drawable/progress_indeterminate_horizontal"
android:progressDrawable="#drawable/progress_horizontal"
android:minHeight="24dip"
android:maxHeight="24dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
As I wanted to change the background of my progress bar, I changed the ProgressDrawable and IndeterminateDrawable. The original drawables are located under frameworks/base/core/res/res/drawable. Copy them to your project and change the color according to your needs.
Create a thread which updates the progress count and does a Thread.Sleep. Then it sends the message to the Handler which will update the progress bar in UI thread.
Use the method setIndeterminate of ProgressBar:
android.widget.ProgressBar bar = new android.widget.ProgressBar(context);
bar.setIndeterminate(true);
But yeah, you could have found this pretty quickly in the developer docs.
http://developer.android.com/reference/android/widget/ProgressBar.html#setIndeterminate%28boolean%29
Maybe a bit late, but you can do something like this:
<ProgressBar
android:id="#+id/progress"
android:layout_width="match_parent"
android:layout_height="10dp"
android:indeterminate="true"
style="?android:attr/progressBarStyleHorizontal" />
Hope it helps someone!
To expand on Vinoth Answer, here is a ready code:
<ProgressBar
android:id="#+id/progressBarLoadingRecite"
android:indeterminateDrawable="#android:drawable/progress_indeterminate_horizontal"
android:minHeight="24dip"
android:layout_marginTop="20dip"
android:indeterminate="true"
android:maxHeight="24dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
In the xml defining your progress bar, you can add
style="#android:style/Widget.ProgressBar.Horizontal"

Categories

Resources