android– 如何旋转浮动动作按钮而不旋转阴影?

android– 如何旋转浮动动作按钮而不旋转阴影?,第1张

概述我以这么简单的方式旋转FAB:fab.startAnimation(AnimationUtils.loadAnimation(this,R.anim.rotate));rotate.xml:<?xmlversion="1.0"encoding="utf-8"?><setxmlns:android="http://schemas.android.com/apkes/android">&lt

我以这么简单的方式旋转FAB:

fab.startAnimation(AnimationUtils.loadAnimation(this, R.anim.rotate));

rotate.xml:

<?xml version="1.0" enCoding="utf-8"?><set xmlns:androID="http://schemas.androID.com/apk/res/androID">    <rotate        androID:fromdegrees="0"        androID:todegrees="360"        androID:pivotX="50%"        androID:pivotY="50%"        androID:duration="1000"/></set>

这有效,但与FAB一起,它的阴影旋转.但我只需要FAB旋转(甚至它的src图像,如果有任何差异).

解决方法:

您是否尝试过使用Compat库提供的animate方法?使用Animation utils时我也遇到了同样的问题

final OvershootInterpolator interpolator = new OvershootInterpolator();VIEwCompat.animate(fab).           rotation(135f).           withLayer().           setDuration(300).           setInterpolator(interpolator).           start();
总结

以上是内存溢出为你收集整理的android – 如何旋转浮动动作按钮而不旋转阴影?全部内容,希望文章能够帮你解决android – 如何旋转浮动动作按钮而不旋转阴影?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

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

原文地址: https://outofmemory.cn/web/1097924.html

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

发表评论

登录后才能评论

评论列表(0条)

保存