在一个视图上应用动画时,Android 会重绘所有视图
我有一个应用程序,其中包含一个具有多个视图的布局,当我为一个视图设置动画时,所有视图都会被重绘! 这是正常行为还是我在做错误的事情? 我想取消此行为并重新绘制我手动无效的视图 谢谢,
<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 >
我有两个自定义视图,并且 SecondArc 视图每秒都会动画化,因此每秒重绘 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);}
I have an Application that contains one layout with sevral views, when i animate one view all views are getting redrawn!
is that the normal behavior or i am doing something false ?
i would like to cancel this behavior and just redraw the views that i manually invalidate
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 >
i have say two custom views and the secondsArc view ist being animated every second and therefor redrawn 10 times per second
the problem is that the MinutesArc is also redrawn !
the prolem is that i have about 10 views and all of the are redrawn 10 times per second
.this method is called in the SecondsArc to rotate it
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);}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论