Android UI(继承控件)--PopupWindow设置动画
生活随笔
收集整理的這篇文章主要介紹了
Android UI(继承控件)--PopupWindow设置动画
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
1,在res/anim 下定義popupwindow 出現(xiàn)和消失的動畫
①出現(xiàn)的動畫popupwindow_show.xml
1 <?xml version="1.0" encoding="utf-8"?> 2 <alpha xmlns:android="http://schemas.android.com/apk/res/android" 3 android:duration="1000" 4 android:fromAlpha="0.0" 5 android:fillAfter="true" 6 android:interpolator="@android:anim/accelerate_decelerate_interpolator" 7 android:toAlpha="1.0" > 8 </alpha>②消失的動畫popupwindow_dismiss.xml
1 <?xml version="1.0" encoding="utf-8"?> 2 <alpha xmlns:android="http://schemas.android.com/apk/res/android" 3 android:duration="1000" 4 android:fromAlpha="1.0" 5 android:fillAfter="true" 6 android:interpolator="@android:anim/accelerate_decelerate_interpolator" 7 android:toAlpha="0.0" > 9 </alpha>2,popupwindow的動畫是通過方法setAnimationStyle(R.style.popupwindow_anim_style);設(shè)置的。
所以在res/values 下的styles.xml 中 添加
1 <style name="popupwindow_anim_style"> 2 <item name="android:windowEnterAnimation">@anim/popupwindow_show</item> 3 <item name="android:windowExitAnimation">@anim/popupwindow_dismiss</item> 4 </style>3,應(yīng)用到代碼中
mPopupWindow.setAnimationStyle(R.style.popupwindow_anim_style); mPopupWindow.update();?
轉(zhuǎn)載于:https://www.cnblogs.com/wangziqiang/p/4184306.html
總結(jié)
以上是生活随笔為你收集整理的Android UI(继承控件)--PopupWindow设置动画的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: php集成环境wamp搭建后,如何配置服
- 下一篇: CKPT进程工作机制