admin管理员组文章数量:1570215
2024年3月18日发(作者:)
IT在线教育平台———麦子学院:
android中提供了如下4种动画效果:
1、AlphaAnimation 透明度动画效果
2、ScaleAnimation 缩放动画效果
3、TranslateAnimation 位移动画效果
4、RotateAnimation 旋转动画效果
今天主要讲解RotateAnimation 旋转动画效果的实现方法。
RotateAnimation 参数有:float fromDegrees, float toDegrees, int pivotXType,
float pivotXValue, int pivotYType, float pivotYValue
分别是:
float fromDegrees:旋转的开始角度。
float toDegrees:旋转的结束角度。
int pivotXType:X轴的伸缩模式,可以取值为ABSOLUTE、RELATIVE_TO_SELF、
RELATIVE_TO_PARENT。
float pivotXValue:X坐标的伸缩值。
IT在线教育平台———麦子学院:
int pivotYType:Y轴的伸缩模式,可以取值为ABSOLUTE、RELATIVE_TO_SELF、
RELATIVE_TO_PARENT。
float pivotYValue:Y坐标的伸缩值。
代码示例:
public class MainActivity extends Activity {
ImageView image;
Button start;
Button cancel;
@Override
public void onCreate(Bundle savedInstanceState) {
te(savedInstanceState);
setContentView(ty_main);
image = (ImageView) findViewById(_img);
start = (Button) findViewById(_start);
IT在线教育平台———麦子学院:
cancel = (Button) findViewById(_cancel);
/** 设置旋转动画 */
final RotateAnimation animation =new
RotateAnimation(0f,360f,VE_TO_SELF,
0.5f,VE_TO_SELF,0.5f);
ation(3000);//设置动画持续时间
/** 常用方法 */
//eatCount(int repeatCount);//设置重复次数
//lAfter(boolean);//动画执行完后是否停留在执行完的状态
//rtOffset(long startOffset);//执行前的等待时间
lickListener(new OnClickListener() {
public void onClick(View arg0) {
mation(animation);
/** 开始动画 */
IT在线教育平台———麦子学院:
ow();
}
});
lickListener(new OnClickListener() {
public void onClick(View v) {
/** 结束动画 */
();
}
});
}
}
更多android视频学习教程,请
看>>/course/2/。
至麦子学院官网查
版权声明:本文标题:Android开发RotateAnimation详解 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/dianzi/1710750846a281641.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论