How can i give a slide down animation like this :
<set xmlns:android="http://schemas.android.com/apk/res/android" >
<translate
android:duration="1000"
android:fromYDelta="0"
android:toYDelta="100%" />
</set>
for " Option Menu " Opening .like this animation :
To disable menu animations just uncheck the two below-mentioned options: Animate controls and elements inside windows – This option will disable animations inside a particular window, like the one you see while navigating “Settings.” Animate windows when minimizing and maximizing – This will disable animation you...
To animate the menu we need to add the animation property to the dropdown_menu. The animation-name property should be set the name we give to the @keyframes rule, in this case, growDown. The animation-fill-mode property defines what styles should be applied at the end of the animation.
The animation creates a relationship between the menu and the action that generates the menu. A menu’s position on screen affects where and how it will appear. If opened at the top of the screen, it will expand downwards (to avoid being cropped). Menus at different positions on screen open in different ways, adapting to the space available.
Android Option Menus are the primary menus of android. They can be used for settings, search, delete item etc. Here, we are going to see two examples of option menus. First, the simple option menus and second, options menus with images.
just add this line into your style.xml please add this on your Application main Style that you define in manifest
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:popupAnimationStyle">@style/Animation</item>
</style>
style.xml :
<style name="Animation">
<item name="android:windowEnterAnimation">@anim/your_specific_animation</item>
<item name="android:windowExitAnimation">@anim/your_specific_animation</item>
</style>
create a xml in anim folder
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true">
<scale
android:duration="500"
android:fromXScale="1.0"
android:fromYScale="0.0"
android:toXScale="1.0"
android:toYScale="1.0" />
In activity call the animation
Animation animation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.myanimation);
image.startAnimation(animation);//place the syntax in options menu
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