Android音乐通知布局的按钮加动效

Android音乐通知布局的按钮加动效,第1张

需要添加代码按钮才有动效。在Android音乐通知布局中,createCircularReveal方法创建了一个Animator,设置动画的中心位置(cx,cy),起始半径(radius)、结束半径(0),在动画播放之前,设置了一个事件监听器,布局按钮就有动画播放效果了。

添加layout布局文件,在xml设置动画属性即可,上下左右四个方向均可以实现 。animation in / off

例如:

1.slide_in_right

<set xmlns:android="http://schemas.android.com/apk/res/android" >

<translate

android:duration="100"

android:fromXDelta="-100.0%p"

android:toXDelta="0.0" />

</set>

2.slide_in_right

<set xmlns:android="http://schemas.android.com/apk/res/android" >

<translate

android:duration="100"

android:fromXDelta="100.0%p"

android:toXDelta="0.0" />

</set>

3.slide_out_left

<set xmlns:android="http://schemas.android.com/apk/res/android" >

<translate

android:duration="100"

android:fromXDelta="0.0"

android:toXDelta="-100.0%p" />

</set>

4.slide_out_right

<set xmlns:android="http://schemas.android.com/apk/res/android" >

<translate

android:duration="100"

android:fromXDelta="0.0"

android:toXDelta="100.0%p"/>

</set>

具体可参考以下博文:

activity左进右出动画 http://blog.csdn.net/csdn_yang123/article/details/52292931

Android 仿微信Activity进入退出动画http://blog.csdn.net/jdsjlzx/article/details/43736707


欢迎分享,转载请注明来源:内存溢出

原文地址:https://www.54852.com/bake/11741382.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-18
下一篇2023-05-18

发表评论

登录后才能评论

评论列表(0条)

    保存