上一篇博客PopupWindow在各个位置的弹出,没有详细附上xml动画,这里都贴上来
PopupWindow是从可见屏幕外弹出的,这里要了解手机的x轴和y轴
上图:
这里android:fromYDelta=”100%p”
意思就是从Y轴的100%p开始进入
android:toYDelta=”0”
意思移动到Y轴0的位置结束
push_bottom_in.xml
<?xml 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="200"
/>
</set>
push_bottom_out.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:fromYDelta="0"
android:toYDelta="50%p"
android:duration="200"
/>
</set>
push_left_in.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:fromXDelta="-100%p"
android:toXDelta="0"
android:duration="200"
/>
</set>
push_left_out.xml
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:fromXDelta="0"
android:toXDelta="-100%p"
android:duration="200"
/>
</set>
这里只是改变进入位置和退出位置,以达到window从不同位置进入的效果

本文详细介绍了如何使用XML定义PopupWindow的进出动画,并提供了具体的动画文件示例,包括从底部滑入、从左侧滑入等不同场景下的动画实现。
2753

被折叠的 条评论
为什么被折叠?



