标签: rotateanimation

为什么在视图动画后setVisibility不起作用?

为什么textView不会变得不可见?

这是我的布局xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <TextView
    android:id="@+id/tvRotate"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Rotate Me"
/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

..这是我的活动:

public class RotateMeActivity extends Activity
{
    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        TextView tvRotate = (TextView) findViewById(R.id.tvRotate);

        RotateAnimation r = new RotateAnimation(0, 180, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
        r.setDuration(0);
        r.setFillAfter(true);
        tvRotate.startAnimation(r);
        tvRotate.setVisibility(View.INVISIBLE);
    }
}
Run Code Online (Sandbox Code Playgroud)

我的目标是旋转视图,然后通过设置setVisibility隐藏并在代码中显示它.以下工作,但setRotation仅在API级别11中可用.我需要在API级别10中执行此操作.

tvRotate.setRotation(180);//instead of the RotateAnimation, only works in API Level 11
tvRotate.setVisibility(View.INVISIBLE);
Run Code Online (Sandbox Code Playgroud)

animation android visibility rotation rotateanimation

63
推荐指数
4
解决办法
3万
查看次数

如何在Android上重复旋转动画时消除延迟?

我已经RotateAnimation在XML中构建了一个XML,加载它AnimationUtils并将其设置为ImageView.我面临的问题是,当图像在一轮之后回到其初始位置时,而不是直接进入下一轮,那里有一个小的超时,就像滞后一样.

有没有解决方案来删除此超时?

您可以在下面找到动画的xml:

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >
    <rotate
        android:interpolator="@android:anim/linear_interpolator"
        android:duration="1800"
        android:fromDegrees="0"
        android:pivotX="50%"
        android:pivotY="50%"
        android:repeatCount="infinite"
        android:toDegrees="360"/>
</set>
Run Code Online (Sandbox Code Playgroud)

提前致谢!

android android-animation rotateanimation

9
推荐指数
1
解决办法
5733
查看次数

Android:同时翻译和旋转动画

我想以编程方式同时显示两个动画而不是XML文件.它应该ROTATE和TRANSLATE 我该怎么做?

请建议我一些方法??????

这是ma代码:>

ImageView snowImg1 = (ImageView) findViewById(R.id.snowimg1);
        snowImg1.setVisibility(0);
        ImageView snowImg2 = (ImageView) findViewById(R.id.snowimg2);
        snowImg2.setVisibility(0);
        ImageView snowImg3 = (ImageView) findViewById(R.id.snowimg3);
        snowImg3.setVisibility(0);
        ImageView snowImg4 = (ImageView) findViewById(R.id.snowimg4);
        snowImg4.setVisibility(0);
        ImageView snowImg6 = (ImageView) findViewById(R.id.snowimg6);
        snowImg6.setVisibility(0);
        ImageView snowImg5 = (ImageView) findViewById(R.id.snowimg5);
        snowImg5.setVisibility(0);

        View snowArray[] = {snowImg1, snowImg2, snowImg3, snowImg4, snowImg5, snowImg6};

        Animation snowMov7 = new RotateAnimation(0,360, Animation.RELATIVE_TO_SELF,0.5f , Animation.RELATIVE_TO_SELF,0.5f );
        snowMov7.setRepeatCount(Animation.INFINITE);
        Animation snowMov1 =  new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.1f, Animation.RELATIVE_TO_PARENT, 0.3f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.9f);
        snowMov1.setDuration(10000);
        Animation snowMov2 = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.3f, Animation.RELATIVE_TO_PARENT, …
Run Code Online (Sandbox Code Playgroud)

animation android-2.1-eclair rotateanimation translate-animation

8
推荐指数
1
解决办法
8744
查看次数

错误setBackground动画后查看

我创建了一个CustomView扩展View.创建一些CustomView并使用动画来移动和旋转它们.更改backgroundResource和错误发生后,新的背景不会填写所有CustomView.请看代码:

    clearAnimation();
    AnimationSet animation = new AnimationSet(true);
    TranslateAnimation translateAnimation = new TranslateAnimation(0, destX - srcX, 0, destY - srcY);
    translateAnimation.setInterpolator(new LinearInterpolator());
    translateAnimation.setDuration((long) MGConstant.ANIMATE_DURATION);
    animation.addAnimation(translateAnimation);

    final float finalX = destX;
    final float finalY = destY;

    animation.setAnimationListener(new AnimationListener() {

        public void onAnimationEnd(Animation arg0) {
            clearAnimation();
            setX(finalX);
            setY(finalY);

            RotateAnimation rotateAnimation = new RotateAnimation(0, degrees, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
            rotateAnimation.setInterpolator(new LinearInterpolator());
            rotateAnimation.setDuration((long) MGConstant.ANIMATE_DURATION);
            rotateAnimation.setFillAfter(true);
            startAnimation(rotateAnimation);
            resetLayout();

            mMoveStatus = false;
            degree = degrees;

        }

        public …
Run Code Online (Sandbox Code Playgroud)

animation android rotateanimation translate-animation

6
推荐指数
1
解决办法
372
查看次数

如何在Windows Phone 8中连续旋转?

我用这个代码进行轮换

void rotate()
{
    Duration Time_duration = new Duration(TimeSpan.FromSeconds(20));
    Storyboard MyStory = new Storyboard();
    MyStory.Duration = Time_duration;
    DoubleAnimation My_Double = new DoubleAnimation();
    My_Double.Duration = Time_duration;
    MyStory.Chil*emphasized text*dren.Add(My_Double);
    RotateTransform MyTransform = new RotateTransform();
    Storyboard.SetTarget(My_Double, MyTransform);
    Storyboard.SetTargetProperty(My_Double, new PropertyPath("Angle"));
    My_Double.To = 270;
    this.maincan.RenderTransform = MyTransform;
    this.maincan.RenderTransformOrigin = new Point(0.5, 0.5);
    //stackPanel1.Children.Add(image1);
    MyStory.Begin();
}
Run Code Online (Sandbox Code Playgroud)

它工作,但我想连续旋转图像.

c# rotation windows-phone-7 rotateanimation

5
推荐指数
2
解决办法
2088
查看次数

android什么应该是枢轴指向旋转图像围绕其基地的中心

在标记重复或关闭之前,请仔细阅读整个问题

我想围绕其基点的中心点旋转图像(特别是箭头图像).

例如,在开始时,我的图像将像9中的时钟中的秒针.并且假设如果我将该图像旋转30度,它应该看起来像时钟秒针10和120度时钟秒针1.

所以我想围绕它的基座中心(沿x轴)旋转那个图像.

那么如果我第一次编码,我应该作为枢轴(X和Y)传递什么

imageView.setPivotX(1f);
            imageView.setPivotY(1f);
            imageView.setRotation(-30);
Run Code Online (Sandbox Code Playgroud)

或第二个代码

Matrix matrix = new Matrix();
    imageView.setScaleType(ScaleType.MATRIX);
    matrix.postRotate((float) 20, 0f, 0f);
    imageView.setImageMatrix(matrix);
Run Code Online (Sandbox Code Playgroud)

或第三代码

Bitmap myImg = BitmapFactory.decodeResource(getResources(), R.drawable.arrow_0_degree);
    Matrix matrix = new Matrix();
    matrix.postRotate(30);
    Bitmap rotated = Bitmap.createBitmap(myImg, 0, 1, myImg.getWidth(), myImg.getHeight(), matrix, true);
    imageView.setImageBitmap(rotated);
Run Code Online (Sandbox Code Playgroud)

或第四个代码

final RotateAnimation rotateAnim = new RotateAnimation(0.0f, degree,
        RotateAnimation.RELATIVE_TO_SELF, 0.5f,
        RotateAnimation.RELATIVE_TO_SELF, 0.5f);

rotateAnim.setDuration(0);
rotateAnim.setFillAfter(true);
imgview.startAnimation(rotateAnim);
Run Code Online (Sandbox Code Playgroud)

添加了一个图像,以便更好地理解沿顺时针方向旋转90度.

我希望将来google会添加更多关于支点的文档.

提前致谢.在此输入图像描述

android image rotation image-rotation rotateanimation

5
推荐指数
1
解决办法
5893
查看次数

使用RotateAnimation在Android中围绕固定点旋转ImageView

我想在固定点周围连续旋转360度图像.我已经看过几个例子,例如:

RotateAnimation anim = new RotateAnimation(0, 360,150,150);
anim.setInterpolator(new LinearInterpolator());
anim.setRepeatCount(Animation.INFINITE);
anim.setDuration(2000);
[imageview].startAnimation(anim);
Run Code Online (Sandbox Code Playgroud)

这会旋转图像,但它会在弧/圆形路径上旋转.IE浏览器.图像以圆周运动方式移动/旋转,但不会固定在它的起始位置.

我基本上想要的是模仿WindMill手臂的旋转.

有什么想法吗?

android fixed-point rotation imageview rotateanimation

4
推荐指数
1
解决办法
7637
查看次数

球形动画与文本在Android应用程序中使用标签云[新闻共和国]

我想在我类似的Android应用创建球形动画新闻共和国的应用程序.

我到目前为止尝试创建一个球体但是任何人都可以指导我如何在android中开发这样的动画.

我们是否必须仅使用opengl,或者我们可以使用其他替代选项来实现它.

此外,单击文本时,它会在不同的屏幕中打开相关新闻.

在此输入图像描述

在此输入图像描述

在此输入图像描述

编辑

我终于找到了一些解决方案,可以在这个包下找到.

但是,动画不够流畅.

让我知道是否有人可以帮助我平滑动画?

android opengl-es tag-cloud opengl-es-2.0 rotateanimation

3
推荐指数
1
解决办法
818
查看次数

如何降低Android中RotateAnimation的速度

如何降低RotateAnimation实例的旋转速度.我正在使用以下代码片段来制作动画.

rotateAnimation = new RotateAnimation(currentRotation, currentRotation + (360 * 5), Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
currentRotation = (currentRotation + (360 * 5));
rotateAnimation.setDuration(10000);
rotateAnimation.setInterpolator(new LinearInterpolator());
rotateAnimation.setRepeatCount(Animation.INFINITE);
rotateAnimation.setRepeatMode(Animation.INFINITE);
rotateAnimation.setFillEnabled(true);
rotateAnimation.setFillAfter(true);
rotateAnimation.setAnimationListener(animationInListener);
recordRingImageView.startAnimation(rotateAnimation);
Run Code Online (Sandbox Code Playgroud)

android linear-interpolation android-animation rotateanimation

2
推荐指数
1
解决办法
3215
查看次数

从视图中心旋转动画不起作用

我想为我的视图制作一个旋转动画但是在两边(java和xml)我无法找到任何方法从它的中心旋转视图

<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="500"
android:fromDegrees="0"
android:pivotX="50%"
android:pivotY="50%"
android:repeatCount="infinite"
android:repeatMode="reverse"
android:toDegrees="180" />
Run Code Online (Sandbox Code Playgroud)

还有这个:

RotateAnimation animation = new RotateAnimation(0,180,
            Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
            0.5f);
Run Code Online (Sandbox Code Playgroud)

它们都从角落旋转视图

请帮我

android pivot center rotateanimation

2
推荐指数
1
解决办法
4853
查看次数