小编ale*_*kla的帖子

在一个视图上应用动画时,Android正在重绘所有视图

我有一个包含一个带有sevral视图的布局的应用程序,当我为一个视图设置动画时,所有视图都被重绘了!这是正常的行为还是我做错了什么?我想取消此行为,只是重绘我手动使thanx无效的视图

<SecondsArc 
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/secondsArc" 
android:background="#00000000" 
android_layout_gravity="center"></SecondsArc >

<MinutesArc
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/minutesArc" 
android:background="#00000000" 
android_layout_gravity="center"></MinutesArc >
Run Code Online (Sandbox Code Playgroud)

我说两个自定义视图和secondsArc视图每秒都被动画,因此每秒重绘10次,问题是MinutesArc也被重绘了!问题是,我有大约10个视图,所有的都被重新绘制每秒10次.这个方法在SecondsArc中被调用来旋转它

public void rotateByDegree(float degree){
    RotateAnimation rotateAnim = new RotateAnimation(currentDegree, currentDegree + degree, getWidth()/2,270);
    rotateAnim.setDuration(600);
    rotateAnim.setFillAfter(true);
    rotateAnim.setFillEnabled(true);
    this.startAnimation(rotateAnim);}
Run Code Online (Sandbox Code Playgroud)

animation android view redraw invalidation

6
推荐指数
0
解决办法
656
查看次数

标签 统计

android ×1

animation ×1

invalidation ×1

redraw ×1

view ×1