PopupWindow添加动画效果
2020-12-13 03:58
标签:android style blog http color 文件 1.定义PopupWindow弹出与消失的两个动画文件,放在anim文件夹下 popup_enter.xml popup_exit.xml 2.styles.xml文件中注册这两个动画效果 3.为创建的PopopWindow添加动画 PopupWindow添加动画效果,搜素材,soscw.com PopupWindow添加动画效果 标签:android style blog http color 文件 原文地址:http://www.cnblogs.com/jsczljh/p/3825793.htmlxml version="1.0" encoding="utf-8"?>
set xmlns:android="http://schemas.android.com/apk/res/android">
translate
android:fromYDelta="100%p"
android:toYDelta="0"
android:duration="1000"/>
alpha
android:fromAlpha="0.0"
android:toAlpha="1.0"
android:duration="1000"/>
set>
xml version="1.0" encoding="utf-8"?>
set xmlns:android="http://schemas.android.com/apk/res/android">
translate
android:fromYDelta="0"
android:toYDelta="100%p"
android:duration="1000"/>
alpha
android:fromAlpha="1.0"
android:toAlpha="0.0"
android:duration="1000"/>
set>
resources>
style name="popupAnimation">
item name="android:windowEnterAnimation">@anim/popup_enteritem>
item name="android:windowExitAnimation">@anim/popup_exititem>
style>
resources>
inflater = getLayoutInflater();
layout = inflater.inflate(R.layout.menu, null);
menu = new PopupWindow(layout, WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT);
menu.setAnimationStyle(R.style.popupAnimation);//添加动画