using animation in imageview while changing image - android

I have used the code here to animate changing image of an ImageView. But it converts the first image to a white screen and then fade the white screen into the final image (no matter if I use background for ImageView or not).
the same effect is appeared when using slide_out_right and slide_in_left.
Question:
How can I directly go from current Image to a new Image using a custom Animation?
I know that it is possible when using ImageSwitcher but I wanne do it in an ImageView
TransitionDrawable is not the solution because it is applicable only for fade. I wanna use translate or any custom animation.
thanks for any help
Edit:
I think I got the answere, but I am not sure if it an efficient solution:
the white screen is because I am animating the whole ImageView. when it goes out the display what appeared is the Layout background which is white.
To solve the problem, I used two ImageViews and copy the current Image to one and the new image to the another one. animation_in is applied to the imageview containing new image and animation_out to the other one.

Related

how to make rectangle with custom imaged border so i can animate it later?

i want to make animated view as shown in the link
https://streamable.com/fpax52
there is an image selected and it should be rectangled and then animated with rgb
i have tried drawing canvas, but not sure that is proper way.
canvas?.drawBitmap(bitmap, 0f,0f,p)
it only drawes one image.
I also thought about creating multiple imageviews as rectangle but i think it is not good idea also.

Android - creating background image

I'm new to android programming and I was wondering about how to get a background image (ImageView) show a drawable with a correct size.
Let me explain well, let's imagine we have this image:
I want this image to get shown with this aspect ratio on all screens.
Since I don't want the image to get stretched, I would like to set manually how my image gets shown, maybe by modifying its scale with thirdy part software.
the problem with this image is that, in portrait mode, it's not guaranteed to see the ball, and so I want to crop the part of my image so that the ball gets shown on the bottom-right edge.
I know that I have to import my drawable for all resolutions, but simply importing does not help... Any suggestions?
EDIT:
I'm facing this problem with dynamic background ImageView, so I'm not going to user xml layout files.
Using scaleType attribute doesn't help for this, or at least not just by setting its value.

Android automatically scrolling background for large image

I would like to create a background which contains large (very wide) image which keeps on scrolling in an infinite loop.
So basically, each time, only a rectangle of the image (cropped) is shown and that rectangle keeps on scrolling smoothly on top of the image in turn showing a different part of the image.
How do I do that?
You can set the .gif image file in the background:
Is it possible to set an animated gif file as background of my app in android?
OR
You can implement Parallax by yourself

How to make this type of drawable in xml

I want to make a transparent circle in center of screen and an opaque are on rest of screen. Is this possible with drawable? Or can it be done programmatically.
I have added an image on top of map. Map works perfectly. But problem is I want to support multiple resolutions so I don't want to use different images.
https://www.dropbox.com/sh/yyafqik996p4avp/AABc8ZMKi4pks_BQutQrbg8aa?dl=0
EDIT:
1)Map image is what is my expected output.
2)Mapfilter image is what i want to create using drawable or programmatically.
3)Output image is what i am getting while using below method.
I used this method to draw the second image
http://pastebin.com/MUrH8gmS
I set the output bitmap to my image view using setImageBitmap method
But now the problem is it leaves some space on left and right of image(See Output.png image). How to remove it?
You can use GroundOverlay.GroundOverlay to set the transparent circle image onto the center of the map.

Android image animation

I've been doing the following for the last three days without any success.
Suppose I have one image. I have set that image invisible in my XML layout. Now I want to make it visible through animation. Suppose translate animation.
Suppose there is point A and point B. On point B I have already set the image invisible. From point A I want a translate animation effect. And when it completes, the image B becomes visible.
Please help me.
try using ViewFlipper (or ViewAnimator) setting your ImageView as children and defining animation effect for transition

Categories

Resources