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.
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.
Sometimes you see in android applications that the move the button from one side of the screen to another (cosmetic stuffs) and it looks nice. Kind of like powerpoint presentation when you slide in text.
I was wondering, are these done typically using Animations in android classes or is it moved using coordinates/draw function in a loop. I am not sure which way is typically this done.
Thank you
I am not sure what exactly you mean (maybe you can give a specific example/app), but usually you use the Animation class to create an animation. There are some specific animations (subclasses) that can be used, but you can also create your own (by subclassing or via xml).
The one you describe sounds like the TranslateAnimation, that just translates the coordinates of a view at the beginning of an animation to coordinates at the end of the animation.
Also take a look here, for further reference.
http://developer.android.com/training/animation/index.html
http://developer.android.com/guide/topics/graphics/view-animation.html
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
Is possible to do a vertical scroller animation in Android without using javascript? Anybody knows a tutorial o a web page with a helpful code? thanks
I'm not sure of what you mean by vertical animation but I think this tutorial can help you.
Animations of views are based on Interpolators that you can set, and one of them is the LinearInterpolator which is detailed here.
EDIT, further to the comments below:
This is something you can do with the scrolling and animation features of the View class, as described here (ctrl-f "Scrolling" and "Animation" in that page).
Should the API level you are using be too low, this is also something you can do with a Thread that modified the position of the TextView embedded in your layout or that uses the scrollXX() functions. This is also described in the page linked above.
Have you looked at the viewflipper control.
I've tried this in the past and it works well. You can also use ViewAnimator class
UPDATE
The google documentation is a bit hard to chew through. You may wish to try this simple tutorial first.
First off, I'm a beginner. If this is way beyond the scope of a beginner's first application, just tell me.
The best way to explain what I want is as an example: In Robo Defense, when you kill something, a little $10 pops up, animate translates/fades up about 5% of the screen and disappears. (almost like a toast, appears on top of canvas)
I'm looking for something similar to that same effect. As a like, top-layer drawable that ignores the underlying defined XML layout. I can handle the animation part of the code, but I'm curious as to how to create and inflate that view without wreaking chaos on my current layout. If it would be easier as a drawable instead of text, thats really not a big problem for my project. It is simply imformative, no interactivity at all, it will just be a quick little 500ms artifact to show that an action has occurred.
I could use a pointer in the right direction, or some similar code examples please.
I think you would create the TextView within your Java code, and then use an animation to make it rise and fade, once the animation has finished, destroy the TextView.
I've never done this before, but I think that should work!
To anyone else who is wondering, I ended up accomplishing this via wrapping my entire layout in RelativeLayout, making the appropriate changes necessary, then creating a TextView programmatically with layout_above, and then calling an Animation on it.