Option Menu Animation
Asked Answered
L

2

9

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

Local answered 24/8, 2016 at 7:5 Comment(0)
P
8

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

Pinkster answered 24/8, 2016 at 13:28 Comment(1)
Doesn't worked for me. I'm trying to actually disable the animations entirely.Jointly
G
1

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
Glaikit answered 24/8, 2016 at 7:23 Comment(1)
i create option menu like this : "@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu, menu); return true; }" i have not any image .Local

© 2022 - 2024 — McMap. All rights reserved.