Android How to Animate Translate Inflate Layout set Start Magin From top - android

animation = new TranslateAnimation(
Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f,
Animation.ABSOLUTE, -300, Animation.ABSOLUTE, 0
I use this code. but i want magin top between start inflate layout and top screen.
how to code it.

Related

how to achieve this kind of animation in android?

tried animations for a cardview in horizontal recycler view, but no luck!!!!
private Animation inFromTopAnimation() {
Animation inFromTop = new TranslateAnimation(
Animation.RELATIVE_TO_PARENT, 0.0f,
Animation.RELATIVE_TO_PARENT, 0.0f,
Animation.RELATIVE_TO_PARENT, -1.0f,
Animation.RELATIVE_TO_PARENT, 0.0f);
inFromTop.setDuration(500);
inFromTop.setInterpolator(new AccelerateInterpolator());
return inFromTop;
}
I got the solution for the question, which is similar.https://github.com/Cleveroad/FanLayoutManager

Android slider button widget

I am a newbie of Android development. I want to implement a sliding button with animation. The effect is shown in the following video: http://www.youtube.com/watch?v=ImHe4N4mvE4. This is like "slide to unlock" effect of iphone. My question is that how to impelment this kind of effect. Is this app implemented with changeview, scrollview ?
you can put an image view with animation in a linear layout whose height is wrap content and width is fill parent
code for animation
public static Animation inFromLeftAnimation() {
Animation inFromLeft = new TranslateAnimation(
Animation.RELATIVE_TO_PARENT, -1.0f, Animation.RELATIVE_TO_PARENT, 0.0f,
Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f
);
inFromLeft.setDuration(350);
inFromLeft.setInterpolator(new AccelerateInterpolator());
return inFromLeft;
}
public static Animation outToLeftAnimation() {
Animation outtoLeft = new TranslateAnimation(
Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, -1.0f,
Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f
);
outtoLeft.setDuration(350);
outtoLeft.setInterpolator(new AccelerateInterpolator());
return outtoLeft;
}

Android animation moves layout from right to left

I use a animation to move a layout from right to left.
The animation doesn't work correctly. When the view is moving, the bottom and right edges of moving view are painted on screen as the follow picture show.
Does anyone know the reason and how to fix this problem? thanks!
refer that link here. That animation work on list view adapter and activity. u just try it.
private Animation inFromRightAnimation() {
Animation inFromRight = new TranslateAnimation(
Animation.RELATIVE_TO_PARENT, +1.0f,
Animation.RELATIVE_TO_PARENT, 0.0f,
Animation.RELATIVE_TO_PARENT, 0.0f,
Animation.RELATIVE_TO_PARENT, 0.0f);
inFromRight.setDuration(500);
inFromRight.setInterpolator(new AccelerateInterpolator());
return inFromRight;
}

How to do webview animation in android

suppose i have three text as heading.Any how you can take textview or anything.one text on left,one in center and one in right side.so i want an animation when i will slide the screen left then left text will be gone,center text will come to left and right text will come to center.Same thing for right slide.Can anyone suggest how can i achieve this type of animation.Plz help.
You can try to create an animation variable :
private Animation leftAnimation() {
Animation outtoLeft = new TranslateAnimation(
Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF, 1.0f,
Animation.RELATIVE_TO_SELF, 0.0f);
outtoLeft.setDuration(500);
outtoLeft.setInterpolator(new AccelerateInterpolator());
return outtoLeft;
}
then
set this action to your frame:
public void onLeftArrowClick(View v) {
frame.setAnimation(moveComingSoonToBottomAnim); // your Frame variable
animVariable.startNow();// your anime variable
frame.setVisibility(View.VISIBLE);
rightFrame.setVisibility(View.GONE); // hide your right text view
}

swipe images in android

I need a little information about how to do a swipe image viewer for Android.Something exactly like this : http://www.photoswipe.com/latest/examples/jquery-mobile.html#&ui-state=dialog .I'm have a listView and I want every time i click an listview item it opens a new windows with the selected image in fullscreen and when I tab on the image,the bottom part with the left right button shows up and some information above the image.In a fullscreen mode I want to be able to swipe left and right and different image shows up.
Any idea how to do this?Thanks a lot!
Insert imageviews inside a viewflipper (here is is called optionsVF)
In your onClick or something:
Animation in = AnimationFactory.inFromRight();
in.setDuration(500);
optionsVF.setInAnimation(in);
Animation out = AnimationFactory.outToLeft();
out.setDuration(500);
optionsVF.setOutAnimation(out);
optionsVF.showNext();
my class :) AnimationFactory
/*
* Copyright 2011 Sherif
*/
public class AnimationFactory {
public static Animation inFromRight() {
Animation inFromLeft = new TranslateAnimation(
Animation.RELATIVE_TO_PARENT, 1.0f, Animation.RELATIVE_TO_PARENT, 0.0f,
Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f
);
inFromLeft.setDuration(500);
inFromLeft.setInterpolator(new AccelerateInterpolator());
return inFromLeft;
}
public static Animation outToLeft() {
Animation inFromLeft = new TranslateAnimation(
Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, -1.0f,
Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f
);
inFromLeft.setDuration(500);
inFromLeft.setInterpolator(new AccelerateInterpolator());
return inFromLeft;
}
}

Categories

Resources