Adding Move/Slide Animation to Group in Android Studio

3141 views java
6

Screenshot : https://i.stack.imgur.com/yYoc5.png

Hello again, can you guys help me to add move animation (not dissapear animation) into groups of image button?

So i create 2 groups.

1st group called "topgroup" contain 4 imagebuttons "categorybutton,searchicon,searchbutton,settingsicon" and an edittext called "txtsearch"

2nd group called "bottomgroup" contain 5 imagebuttons "historybutton,regionbutton,namebutton,culturebutton,languagebutton"

and i have the main imageview "background"

what i want to make is the topgroup move up/slide up when i click background and in the same time the bottomgroup movedown/slidedown as well.

i've been searching some code and some of them work smoothly only in a button. But in a group of buttons the animation turns out to be dissapear/fading animation.

answered question

1 Answer

5

You can make animation files similar to the ones here:

Android Left to Right slide animation

except instead of translating X, translate Y and then just set the animations of your group object in XML (if your buttons are in a horizontal linear layout then add the animation to the layout), and when you need to hide/show them just call view.animate()

you can also see this question for more information on loading / setting the animations in code:

How to make Animation programmatically

posted this

Have an answer?

JD

Please login first before posting an answer.