工作需求,从网上找了好多相关的文章,试了都没效果。后来从一个搞framework的朋友那弄来的解决方案。
本来AndroidQ中已经给Activity加入了属性,如下。奈何framework层并没有解析此属性,所以不生效。不知后续会不会修复此问题。
<activity
…… //此配置无效果!!
android:rotationAnimation="seamless">
话无多说,直接代码:
WindowManager.LayoutParams windowAttributes = getWindow().getAttributes();
windowAttributes.rotationAnimation = WindowManager.LayoutParams.ROTATION_ANIMATION_SEAMLESS;
getWindow().setAttributes(windowAttributes);
在android Q上亲测可用。需要朋友拿走不谢!
原文连接:https://blog.csdn.net/bsfding/article/details/106019914