I'm trying to do something which seems simple. I want to have a map view, with a menu that slides up from the bottom of the screen where settings (for overlay) can be adjusted. However when I use a TranslateAnimation to affect the y position of the LinearLayout (which holds the menu), the buttons in the LinearLayout move, but there "hit area" stays in the same position as they were before the animation.
TranslateAnimation slide = new TranslateAnimation(0,0,0,0);
slide.setDuration(300);
slide.setFillAfter(true);
pullupMenu.startAnimation(slide);
mapContainer.startAnimation(slide);
I've also looked into tweening the view's marginTop value, but haven't even been able to determine how that would be done.
Any help on either of these directions would be much appreciated.
This example demonstrates how do I in android. Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2− Add the following code to res/layout/activity_main. xml.
You can use the view animation system to perform tweened animation on Views. Tween animation calculates the animation with information such as the start point, end point, size, rotation, and other common aspects of an animation.
There are two types of animations that you can do with the view animation framework: Tween animation: Creates an animation by performing a series of transformations on a single image with an Animation. Frame animation: or creates an animation by showing a sequence of images in order with an AnimationDrawable .
Tween animations are a specific type of animation related to rotation, sliding, and movement of an object.
The animation in general is animating the pixels of the widget. My suspicion, based on what you wrote, is that setFillAfter()
merely arranges for the pixels to stay in the destination location, not the widget itself.
If you want the animation to actually wind up moving the widget, you need to:
You can see a sliding pane that employs this technique here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With