This google API tutorial shows how to animate Views. However it uses methods that are available from API level 11, such as View.setAlpha
Now, using a phone with android 2.1 (API 7) I can find many , many applications using the same kind of animations (the card flip animation is very popular)
Are there any Google libraries to do the animations shown in this tutorial that would work with ANY API prior to 11?
If not, any other alternatives?
P.S I am aware of this question But appearantly that was specifically about objectanimator and got an unuseful anser accepted
NineOldAndroids will be able to provide you with animation APIs that you see in 11+. For example...
ViewHelper.setAlpha(view, 0);
Easy animation such as transform, rotate, move (which it seems to be what you want) may be made with such classes as:
http://developer.android.com/reference/android/view/animation/AnimationUtils.html
http://developer.android.com/reference/android/animation/AnimatorSet.html
http://developer.android.com/reference/android/view/animation/Animation.html
In brief you will have create animation resources (or classes) and run it on views. After ending animation possibly you will have hide this view by visibility method.
Check this for details - http://jmsliu.com/779/android-view-animation-example.html.
Related
I need to scroll a list view on one of the screen in my Android app. I did not find any scrollChangeListener which could be used in this case. I need to know the scrollY element and also the direction of scroll(up/down). The project uses minimum Android API as 11.
I did come across OnScrollChangeListener but its for API level 23.
Could someone please help?
I want to know if someone knows a library that contains a back ported implementation for ListPopupMenu that works on pre android 11
I don't but you could use PopupWindow whcich is available since API 1. You can create a list as your contentView. You can use showAsDropDown which could give you the same type of effect
This might be worth checking out. I like to use it for backwards compatibility sometimes for the effect it gives
PopupWindow
showAsDropDown
If I do setAlpha(0.5f) on a few (image) views, my app gets horribly slow, at least on my Android 4.+ tablets.
If I remove the setAlpha calls, the app (scrolling and paging) works smoothly.
Is there an alternative/faster method for making my views semitransparent?
If you provide some code I can try to see what is wrong, there is no reason and explanation of slowing the app, there must be other thing in the code/project/layouts to make your app work slower
Try creating a custom view that calls Canvas.saveLayerAlpha() before drawing its children. Android 3.0+ versions there is a View.setAlpha() api..
Also you can create transparent or opaque background.Here is the link
http://zaman91.wordpress.com/2010/03/22/android-how-to-create-transparent-or-opeque-background/
Hope it helps.
Is there an easy way to implement property animation(e.g. animate "x" or "y" property from value1 to value2) in android < 3.0? I need to animate a visual control(Button or TextView), that needs to handle click events(so, drawable animation is not appropriate).
Update:
So, there is a lot of games with animation(Cut the Rope, etc.). How these game developers solved the problem? What the way they use for animation?
I know this is an old thread, but for those who stumble across this in a Google search, there is a compatibility library available that gives you access to the property animations introduced with Honeycomb all the way back to Android 1.0.
I've used it for some small things, and it works like a charm. http://nineoldandroids.com/
Afaik, for this to work you have to roll your own animation framework first that interpolates the values the way you'd like. Then, you could animate e.g. the margin property of the button with this framework, calling .setLayout() on every tick. This causes the ui-framework to relayout/redraw the whole screen, with the new margin value.
However, this is a terribly slow and wasteful way to animate and I don't recommend it. There might be better solutions.
In my app there a button , and on pressing it the requirement is that an expandable list view should slide out. but the case is that slidingdrawer only moves from bottom to top..
You can try umano's https://github.com/umano/AndroidSlidingUpPanel. Just copy it and see if it fits
This was asked in a similar question: Android SlidingDrawer from top?
To summarize, there are basically two solutions:
On Android 3.0+ (API 11), you can set android:rotation on the SlidingDrawer to 180 degree. And since that will also rotate the children, rotate them an additional 180 degree, to return them to their original orientation. However, since SlidingDrawer was also deprecated in Android 4.2 (API 17), this solution is not recommended as anything more than an interim solution.
The better solution is to write you own implementation or use a similar component from a 3rd party widget library. A few library recommendations can be found in the answers for this question: SlidingDrawer deprecated