自Api等级1起存在RotationAnimation
RotateAnimation animation = new RotateAnimation(from, to,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
animation.setInterpolator(new LinearInterpolator());
animation.setDuration(1);
animation.setFillAfter(true);
imageView.startAnimation(animation );
Run Code Online (Sandbox Code Playgroud)
我开始创建位图并旋转画布/矩阵,但这不是一个好的解决方案。最后,如果满足条件,则仅交换可绘制对象。我应该说这是一个 ExpandableListView,其中在绘制时重复使用单元格。
if (isExpanded) {
ImageView view = (ImageView) convertView.findViewById(R.id.ImageView);
view.setImageResource(R.drawable.quickactions_button_normal_down);
}
if (!isExpanded) {
ImageView view = (ImageView) convertView.findViewById(R.id.ImageView);
view.setImageResource(R.drawable.quickactions_button_normal);
}
Run Code Online (Sandbox Code Playgroud)
我通常不是 Android 开发人员,但我真的很惊讶可以为旋转设置动画,但不能静态设置可绘制对象的旋转。从逻辑上讲,第一个是第二个的子集,而不是相反。
| 归档时间: |
|
| 查看次数: |
4423 次 |
| 最近记录: |