ImageView animation like the Android 4.0+ contact editor - android

I would like to animate my ImageView like the contact editor (the read only mode) in Android 4.0+ does (I am not sure about the version).
But I don't know where to start. I tried to figure out what the source code does, but it is really complicated and I am not even sure, if I am looking at the right source code (PhotoSelectionActivity?).
So, here is what I would like to do:
I have an ImageView (400dp x 200dp, width x height) and a quadratic image resource. I would like to draw my image in that ImageView using the centerCrop scale type (done so far). But when the user clicks the ImageView, it should expand to its full size (if possible do not change the layout size, because it is not the only view in the linear layout), the background (if possible) should fade out.
Any ideas?
Here is an image of the start view:
and when the user clicks the image, an animation should start, ending with this view (keep in mind, that the contacts details are still there, they are just behind the image):
I hope it is clearer now.

To achieve this create two corresponding animations (scale and fade out) with Property Animations
Use NineOldAnroids for backwards compatability with Android 2.x.

Related

Android: how to do this animation?

There is an ImageView with a drawable resource. The animation should begin empty, the resource should progressively appear from the top edge, then it should continue shifting towards the lower edge until it disappear again beyond that.
I'd like to start this animation whenever I want and make it repeat endlessly until I decide to stop it. Any help?
Maybe you can use one of this libraries, this libraries help you and have many examples
https://github.com/2359media/EasyAndroidAnimations
https://github.com/daimajia/AndroidViewAnimations
Also animating resources is possible by writing custom view and modifying onDraw() function, it is not necessary in your case. You need a ViewGroup with an ImageView nested inside. You set your imageview top-padding -imageHeight which make it disappear at the beginning. than you can use property animator (or object animator) to increase top-padding over time up to 0 and dada! now you have your imageview fully shown on the screen.
property animation is an easy concept you can grasp in 5 minutes! Right now i don't have a IDE so there would be no code. good luck

Stretchable ImageView

I beg you not to downvote my question, because it can duplicate other questions, but i didn't find anything.
I want to do Stretchable (or Resizable) ImageView. Attention to pictures:
1. For example we have this layout (screen)
2. My finger down to screen
3. My finger move to screen bottom. So ImageView zoom
4. My finger up to screen. ImageView size was returned with smooth animation
What name of this ImageView? Or how realize this? What do you think?
this view is something like fading action bar :
https://github.com/ManuelPeinado/FadingActionBar
whe you don't know which view is use than just use Hierarchy Viewer
Launch Your App in emulator
Launch the Hierarchy Viewer in eclipse
and debug your UI
Source

How to cross-fadeing image in Android

Basically, I have images that I'd like to to update them sequentially into the same view to create custom ProgressBar.
I found Tumblr to do just that with their ProgressBar(ImageView?).
Here I put the animation side-by-side to show how the image actually cross-fade from Aa into a camera.
Exactly what I wanted:
Cross-fading effect
Indeterminate
Use the same view (I dumped view hierarchy to check)
Animation during transition (The image actually pop a little when spinning and cross-fading into the next image)
So far I have tried:
1. Frame Animation,
this allows for unlimited item(s) with definable durtion. However, it
doesn't cross-fade the image and there's no way to listen to the
transition's event to apply other animation, etc.
2. Transition Drawable, this allows cross-fading between EXACTLY two drawables. So this doesn't allow for the number of items and interminate duration as well.
I also came across CrossFadeDrawable by Romain Guy just now but it looks like it's only coded to support only two Drawable.
Right now I am not very sure if I'm approaching in the right direction or is there something I need to learn in order to do this kid of effect?
I'm not sure if you are approaching this direction but isn't this what you are looking for:
http://www.youtube.com/watch?v=atH3o2uh_94

Which Android layout and view to use for simple image-based game?

I would like to make a simple Android game where a large background image is displayed and some other images are displayed in specific locations over it, where the other images may be clickable.
Here's a quick sample image of what I'm talking about:
The user should be able to tap the soccer player or the moose (ah, the classic "soccer player moose problem"!)
How should I render this screen (which layouts and views?) so the user can interact with it and it will scale properly on different devices?
I would use a RelativeLayout.
You can set the you background image to the layout (fill_parent for height and width).
You can then put your ImageViews, containing your moose and soccer player down on the layout relative to the top or sides of the sceen, or relative to each other (making sure to specify "dp" units for everything). Set the backgrounds of your ImageViews to be transparent, and there won't be a bounding box problem (and/or you can also set your ImageViews alignment to be relative to each other, ensuring they don't overlap).
I think this is the simplest way to do this - it is then super easy to attach onClickListener to your ImageViews in your Activity, and you are done.
This type of layout will work the same on all devices and screen sizes.
There are some small gotcha's with RelativeLayouts, but they are pretty simple once you get into them, and provide fast rendering (since the view hierarchy is usually shallow). Good Luck.
ImageView for the clickable elements seems like a fine choice to me. For the background I would just set your image as the background of the parent layout i.e. RelativeLayout
SurfaceView for the whole thing (with your field as a background) and regular *ImageView*s for added elements. You can easily recover the click coordinates from the SurfaceView and thus know what element has been touched.
SurfaceView might offer you additional possibilities anyway.
For most images, I'd use an ImageView for each one, like FoamyGuy said.
If they're close enough for overlapping bounding boxes to be an issue, you can still use an ImageView for each, but with a variation of this answer, testing alpha for each ImageView in range.
I would agree with both FoamyGuy and Booger that if your only goal is to place static images onto the screen that do something when you click them, RelativeLayout and ImageViews all the way.
But...
If you are looking to randomly spawn multiple images onto the screen in intervals and have them move around for the player to interact with while explosions are going off and maidens are being kidnapped, you should look into SurfaceView, Canvas, Drawable, TouchEvents, and FrameBuffers.

How to achieve this folding effect in android?

This is the effect on the ios
Like the effect of paper folded
PaperFold for iOS :https://github.com/honcheng/PaperFold-for-iOS
I suppose you can use scale animations on ImageViews that simulate the paper already folded. The scale effect would be used when you scroll through and expand the entire paper as you continue to scroll through the sets of images. Once you fully scroll through the paper ImageView and the animation is completed, you just kill the animation and have a normal view of a full page paper. Just make a separate folder for animation and inside that folder, create an XML file, select scale and play around with the attributes to test the best suitable effects for your animation.
Hope this helps!
There is a library that helps to implement not accordion-like but another quite interesting folding effect: http://www.youtube.com/watch?v=GzWGhp_NDTg
The explanation & code here http://cases.azoft.com/creating-paper-folding-animation-in-android/
You can use Foldable Layout Lib.
https://github.com/worldline/FoldableLayout

Categories

Resources