还没有完成,勿看勿看~!!!!
转载请注明:https://blog.csdn.net/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