动画化Android Ring Shape的后掠角 [英] Animate Android Ring Shape's sweep angle
问题描述
尝试对Android Ring Shape进行动画处理,以产生类似于所示图像序列的效果.
Attempting to animate the Android Ring Shape to produce an effect similiar to the shown sequence of images.
我发现了Ring的Shape Drawable类型.
I have found the Shape Drawable type of Ring.
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="ring"
android:innerRadius="75dp"
android:thickness="25dp"
android:useLevel="false">
一起使用ArcShape(startAngle,sweepAngle)方法.
Along with the ArcShape(startAngle, sweepAngle) method.
ShapeDrawable shape = new ShapeDrawable(new ArcShape(0, 360));
shape.setIntrinsicHeight(100);
shape.setIntrinsicWidth(100);
shape.getPaint().setColor(Color.BLACK);
但是,由于找不到可绘制形状的后掠角属性或无法为ArcShape创建内半径而出现问题.
However, the problems arise from being unable to find the drawable shape's sweep angle property or the ability to create an inner radius for ArcShape.
我正在尝试制作平滑的动画.
I am attempting to produce a smooth animation.
推荐答案
有用的材料:使用PorterDuff清除模式,可以移除"内部,留下甜甜圈形状.然后,您可以通过扩展Animation类进行重绘来使用弧的后掠角.
Using PorterDuff Clear mode the inner can be "removed", leaving a doughnut shape. You can then use the Arc's sweep angle by redrawing through extending the Animation class.
这篇关于动画化Android Ring Shape的后掠角的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!