Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Option Menu Animation

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 :

enter image description here

like image 654
Mohammad Tazehkar Avatar asked Aug 24 '16 07:08

Mohammad Tazehkar


People also ask

How do I disable menu animations?

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...

How do you animate a drop down menu in HTML?

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.

How does the animation work with the menu?

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.

What are option menus in Android?

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.


2 Answers

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>

enter image description here

like image 188
ShahinFasihi Avatar answered Nov 16 '22 00:11

ShahinFasihi


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
like image 36
shaik subhani Avatar answered Nov 16 '22 01:11

shaik subhani