2016-08-24 13 views
8

Jak mogę dać slajd w dół animacji takiego:Menu opcji Animacja

<set xmlns:android="http://schemas.android.com/apk/res/android" > 
    <translate 
     android:duration="1000" 
     android:fromYDelta="0" 
     android:toYDelta="100%" /> 
</set> 

dla "menu" Otwarcie .like tej animacji:

enter image description here

Odpowiedz

6

wystarczy dodać tę linię do swojego style.xml proszę dodaj to od aplikacji główny styl, który można zdefiniować w jawnym

<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

+0

Thx za odpowiedź ... to jest dokładnie dla mnie <3 –

+0

powitanie;) – ShahinFasihi

0

utworzyć XML w folderze anim

<?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" /> 

W działalności zadzwonić animacja

Animation animation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.myanimation); 
    image.startAnimation(animation);//place the syntax in options menu 
+0

Tworzę takie menu opcji jak: "@Override public boolean onCreateOptionsMenu (menu menu) { getMenuInflater(). Inflate (R.menu.menu, menu); return true; } " Nie mam żadnego obrazu –

Powiązane problemy