I have a popupwindow that is using a
PopupWindow.setAnimationStyle()
to show a scale in/out animation for create/dismiss .Animation is working fine. I want to know when the scale in animation is complete , but I can't find a way ...
Is there a way to set a listener for the animations listed in animation style.
I guess if I make any of the following idea work , I can achieve it
create an animation style programmatically, so that I can register listeners for the involved animations.
instead of PopupWindow.setAnimationStyle() I can set animation directly to Popupwindow , something like **Popup.setAnimation.
I can get a reference to the animations of the Popupwindow.
I tried everything I can, to find a solution but to no avail.
Please help.
Related
I want to be able to show to my users whenever they recieve a new location update in my app.
So, whenever onRecieve() is called in my activity I want a imageView to animate a single ripple effect.
Ive tried to find a appropriate librabry that can do this easily but with no success.
Given my requirements can anyone point me in the right direction or suggest a good way to accomplish this?
Using this library https://github.com/skyfishjy/android-ripple-background i couldnt make a single ripple effect.. it never stops until i call stopRippleAnimation();
Edit: Using a valueanimator was a perfect solution for this
Call stopRippleAnimation after the ripple animation duration.
Also you can easily perform this animation using valueAnimator, Fadeout and scale using the values between 0 and 1.
I am trying to apply a custom animation to show and hide a Dialog and have come across a certain problem.
A View provides two method for animation which are .animate() which I call a "manual" animation and .startAnimation(Animation animation) which receives an Animation object.
I access the dialog's view by calling alertDialog.getWindow().getDecorView() and try to animate it using startAnimation but that doesn't work. Only if I use the animate function I can animate it.
Here is a code example that, as far as I know, should return the same results but reproduces the problem I'm dealing with:
AlertDialog dialog = AlertDialog.Builder(MainActivity.this).create(); // Create the dialog
View decorView = dialog.getWindow().getDecorView(); // Access the dialog's view
// The animation below works fine
decorView.animate().rotationXBy(45).setDuration(500).start(); // Animate it "manually"
// Create an animation instance
RotateAnimation scaling = new RotateAnimation(0, 45);
scaling.setDuration(500);
scaling.setFillAfter(true);
// This animation does NOT work
decorView.startAnimation(scaling);
I have tried the same code with other views and it works normally so I guess there is some peculiarity for dialogs that break the functionality?
I'd like to know if I'm doing something wrong and, if possible, how can I achieve what I want?
I ended up going other way instead of using dialogs but with them, you really have to manually create your animations step by step instead of using those helpful classes that the platform provides.
I thought it could be some problem related to the view not being ready for the Animation and even started it inside a decorView.post(Runnable) but the same results were obtained.
If anyone else tries this approach (seriously don't, create your own view and animate it normally, you'll run into even worse problems animating the dialog's dismissal) be aware that animating a dialog is not so easy. Maybe look for libraries that do it.
Can anyone tell me what control or how do you create the pop-up effect used in these images to display the legend?
The screenshots are taken from an app called FlyOKC.
Any help is greatly appreciated, thank you.
This is not exactly a custom dialog. But, yes it is still a customized view. And it is more or less called Quick Action Dialog in android. I would suggest you to follow the tutorials below for generating an exactly same popover (or even better) with Android. Check the screenshot also.
http://www.londatiga.net/it/how-to-create-quickaction-dialog-in-android/
http://www.androidpatterns.com/uap_pattern/quick-actions (Pattern Reference)
That's certainly using a custom version of a dialog. The idea is to implement your layout in a xml and inflate it in a dialog. There's a lot of tutorials around, try that one.
Actually, that can be achieved by using RelativeLayout and switching the legend view's visible state between View.VISIBLE and View.GONE in button's click handler.
To get the exact animation you'll need to jump some hoops.
Here are related threads:
How does one Animate Layout properties of ViewGroups?
How do I animate View.setVisibility(GONE)
Also, I think another (and possibly easier) way would be to use Fragments API with transition effects, in which case this is the thread to read:
Animate the transition between fragments
I am trying to learn how to do animation on Android. I want to use tween from my understanding via XML. I want to just highlight a text view, but I can't seem to find any simple examples that work, most seem to go for rotating. Anyone have an idea?
Also once I make the animation work does it block while the animation happens? Should I thread it if I am waiting for it to finish to run another event? I haven't been able to figure this out from reading the documentation. My java threading is very rusty.
Thanks
Animations thread themselves.
You won't be able to do this animation directly, because property animations are only available in Honeycomb. This animation is unnecessarily complicated because of the lack of animations. What you would have to do in order to accomplish this is to place the TextView in a FrameLayout. Create and LinearLayout with the highlight color you would like and Scale or Alpha animate that LinearLayout. If you would REALLY want to do this, I can show you.
I saw one iphone application if the button is visible and we press cancel button then that button should gone. in that case there is animation "the button diposes from left to right and finally got vanished". In android i am able to rotate any view or move it from left to right. But how can i get the effect that the button destroy animation and make a button visible in that type of animation.
Thanks
Deepak
I'm not sure that I fully understand what you're trying to do, but it seems like you want to fade the button as well as translating it. If that's the case, then you can use alpha animations to change the opacity of the button. By gradually reducing the alpha to 0, the button will appear to fade away.
I have recently completed a series on animations on my blog. It is probably best to read the articles in order starting with the first, but the final article covers animating individual widgets.
To get a general idea of animations in android, check out this awesome page on quick actions. There is plenty of code and working animations with different options so you can get a full tutorial of how they work.
How to create quick action dialog