还没有完成,勿看勿看~!!!!
转载请注明:https://blog.youkuaiyun.com/feather_wch/article/details/80097833
Material Design动画
触摸反馈
1、触摸反馈(点击后水波特效)
按钮中添加属性(两种):
<Button
xxxxxx
android:text="有界水波纹"
android:background="?android:attr/selectableItemBackground"/>
<Button
xxxxxx
android:text="无界水波纹"
android:background="?android:attr/selectableItemBackgroundBorderless"/>
揭露效果
2、Reveal Effect实例
- 通过
View的ViewAnimationUtils的方法揭露效果的动画的圆心是以目标View的左上角确定坐标系的
button.post(new Runnable() {
@Override
public void run() {
//圆心
int cx = button.getWidth() / 2;
int cy = button.getHeight() / 2;
//最终半径
int finalRadius = Math.max(button.getWidth(), button.getHeight());
Animator animator = ViewAnimationUtils.createCircularReveal(button, cx, cy, 0, finalRadius);
animator.setDuration(5000);
animator.start();
}
});
3、崩溃错误-解决办法:“揭露动画”需要在View被attache后调用
java.lang.RuntimeException: Unable to start activity ComponentInfo{xxx}: java.lang.IllegalStateException: Cannot start this animator on a detached view!
//1. The Runnable will run after the view's creation. No need to post delay.
view.post(new Runnable()
{
@Override
public void run</

本文详细介绍了Material Design中的触摸反馈、揭露效果和转场动画。触摸反馈包括点击后的水波特效;揭露效果通过特定方法实现动画圆心定位;转场动画部分讲解了Activity的传统转场、ActivityOptions的多种动画实现,以及系统预设的几种动画效果。同时,文章还提到了自定义动画的实现方法,如makeCustomAnimation和makeClipRevealAnimation,并探讨了共享元素转场的细节。
最低0.47元/天 解锁文章
364

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



