The Code City
Search This Blog
Animate View on Visibility (Visible — Gone) Changes Android Example
- Get link
- Other Apps
Default Animations in Android |
We are now done, findViewById refrences the root layout inside which you want to show animations. Now is the time you can build and show or hide some views and test if this works or not! It will work. So wasn’t that easy? Of course you can have you custom animation and not the default changeBounds and Fade animations, but for simple Visibility the default ones are the best in my opinion.
In case you want to show your custom animations, you need to create a LayoutTransition object and supply it to the layout using the setLayoutTransition() method but that the code for some other day!
Also, if you are not interested in XML, you can also apply the same animations when there are layout changes using the beginDelayedTransition method. This method was added in API level 19 so make sure the device satisfies the API level before you use this code:
Источник