简体   繁体   English

在中心旋转图像 pivot - Android

[英]Rotate an Image pivot in the Center - Android

I want to rotate an Image pivoting in the center.我想旋转在中心旋转的图像。 I want to use this when i rotate the image I need to load dynamic Text as menu.我想在旋转图像时使用它,我需要将动态文本加载为菜单。 Like a Jog.就像慢跑一样。 Any one pls help me for rotating an image任何人请帮我旋转图像

To rotate an image you can do this:要旋转图像,您可以这样做:

RotateAnimation rotate = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);

ImageView image = findViewById(my image);
image.setAnimation(rotate);

rotate.start();

This will rotate the image one round from 0 to 360 degrees.这会将图像从 0 度旋转到 360 度一圈。 You can set the duration too:您也可以设置持续时间:

rotate.setDuration( 500 ); // milliseconds

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM