Can anyone suggest me how can I use a refresh icon in my activity? I mean to say that my activity takes time to retrieve data from the server during that time I want to show the refreshed logo moving indicating the user that data retrieval is still in progress. So can anyone suggest to me how that can be done? If possible with an example.
I'm not sure, but what about creating your animation with the "refresh logo" you need?
<?xml version="1.0" encoding="UTF-8"?>
<animation-list android:oneshot="false"
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:duration="200" android:drawable="#drawable/stat_sys_wifi_signal_1_anim0" />
<item android:duration="200" android:drawable="#drawable/stat_sys_wifi_signal_1_anim1" />
<item android:duration="200" android:drawable="#drawable/stat_sys_wifi_signal_1_anim2" />
<item android:duration="200" android:drawable="#drawable/stat_sys_wifi_signal_1_anim3" />
<item android:duration="200" android:drawable="#drawable/stat_sys_wifi_signal_1_anim4" />
<item android:duration="200" android:drawable="#drawable/stat_sys_wifi_signal_1_anim5" />
</animation-list>
Playing with duration, you can display whatever you want at the time you want. More info here.
After, define and show your own CustomDialog, like this example, instead of the standard progess dialog.
If your "refresh logo" is a static image, previus link should be enough.
Use AsyncTask with ProgressDialog.
For more information, here is a great article given: https://sites.google.com/site/androidhowto/how-to-1/asynctasks-with-progressdialogs
You could use a ProgressDialog. There's also the ProgressBar widget.
create custom view , which contains a rotating portion of circle visible .
Related
I am using animation for my button but its too fast when I click the animation happens so fast you can barely see at the moment its just two drawables with a selector.xml state pressed true
How can I so slow the animation just a little bit
You can use android:enterFadeDuration and android:exitFadeDurationto achieve your desired effect.
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" android:enterFadeDuration="400" android:exitFadeDuration="400">
<item android:drawable="#color/pressed" android:state_pressed="true" />
<item android:drawable="#color/default" />
</selector>
This android:duration="200" is the time in miliseconds that your animation will occur. Go for 500 (0,5 seconds) or more if you want.
We are building an Android app where in the place of splash screen while waiting, i want to add an animation just like Boot animation of Moto G. Not exactly the same, but globe with some other elements will be used.
So my question is how to do it something like that?
Any input is much appreciated.
Thanks,
as for android .. you have to make animation manually ..
for this make xml file with animatiom-list under res/drawable .. then add items and give duration ..
EXAMPLE:::::
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false">
<item
android:drawable="#drawable/image1"
android:duration="300"
/>
<item
android:drawable="#drawable/image2"
android:duration="300"
/>
<item
android:drawable="#drawable/image3"
android:duration="300"
/>
<item
android:drawable="#drawable/image4"
android:duration="300"
/>
android:oneshot="false" is to repeat animation again and again .. if you dont want to repeat then make it true
after you make animation .. add it in a imageview ..
I'd like to display a animation with transparent background, on a transparent activity. How can I realize it with Android? I thought about flash, but the user has to have flash installed, right? I'd prefer vector graphics instead of gifs.
Thanks a lot in advance!
Example:
The best way to show an animation is to store them as PNGs and do something like this for an animation, put this in your drawable folder.:
<animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="false">
<item android:drawable="#drawable/ant1" android:duration="100" />
<item android:drawable="#drawable/ant2" android:duration="100" />
<item android:drawable="#drawable/ant3" android:duration="100" />
<item android:drawable="#drawable/ant2" android:duration="100" />
</animation-list>
If you want to use vector graphics, then you have to manually switch the images. You could look into svg-android, which is a great way to use simple vector images in Android.
Hey you this library for animation of background image and set theme Theme.Transparent for activity...so you can achieve your requirement This is the link might be usefull...KenBurnsView
What is the best way to design and embed an animation into an android app.
(I'm not talking about transitions and activities in/out animations.)
I can think of 2 ways of doing it:
designing the animation with flash or something similar, export png-sequence with transparent bgs and creating an animation from the images in an xml file (How do I write this kind of xml?)
creating a grid of images with all the frames of the animation that I've created
and save it into one image. than using something like background-position in css in order to move the visible area of the image on each frame enter (By Java code, or by xml)
which of this is better/most common? and how do I implement the solution (if there is a better solution - that would be great).
and what programs do you usually use for this kind of task
(the goal is to achieve something that works like the frog in cut the rope or the birds in angry birds for example)
thanks!
I used simple animation in one project... It's on your first point... A sequence of *.png files in /res/drawable, and *.xml like:
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="true">
<item android:drawable="#drawable/s250" android:duration="200" />
<item android:drawable="#drawable/s251" android:duration="200" />
<item android:drawable="#drawable/s252" android:duration="200" />
<item android:drawable="#drawable/s253" android:duration="200" />
<item android:drawable="#drawable/s254" android:duration="200" />
<item android:drawable="#drawable/s255" android:duration="200" />
<item android:drawable="#drawable/s256" android:duration="200" />
<item android:drawable="#drawable/s257" android:duration="200" />
<item android:drawable="#drawable/s258" android:duration="200" />
</animation-list>
... and source...
final ImageView pygalo = (ImageView) findViewById(R.id.imageanimation);
pygalo.setBackgroundResource(R.anim.animation);
final AnimationDrawable pygaloanimation = (AnimationDrawable) pygalo.getBackground();
pygalo.setOnClickListener(new OnClickListener()
{
#Override
public void onClick(View vp) {
pygaloanimation.stop();
pygaloanimation.start();
}
});
It is very easy to do...
I'm hoping this question will be easy to answer, I have 2 pictures of identical shape and size, I'd like them to infinitely loop from one to the other as soon as the app starts. It would be similar to an animated gif, they wouldn't move or rotate, just loop repeatedly, and very vast (over 10 loops per second at least). A way to adjust the speed in milliseconds would be a big plus.
Try to use FrameAnimation. There is example in docs.
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false">
<item android:drawable="#drawable/image1" android:duration="200" />
<item android:drawable="#drawable/image2" android:duration="200" />
</animation-list>