小编eli*_*tht的帖子

如何恢复和暂停Android中的ObjectAnimator API级别低于19?

我知道API级别19支持ObjectAnimators上的pause()和resume().但是在API级别14的项目中,我有一个ObjectAnimator应用于Image视图来旋转它.我想在触摸时暂停ObjectAnimator提供的动画,并从图像视图所在的位置(触摸前)恢复它.

所以我试图保存当前的播放时间并取消我的stopAnimation()函数上的对象动画.

private void stopAnimation(){
        currentTime = mGlobeAnimator.getCurrentPlayTime();
        mGlobeAnimator.cancel();
    }
Run Code Online (Sandbox Code Playgroud)

在startAnimation()函数中,我重新创建动画师,将其目标设置为图像视图,设置保存的播放时间并启动它.

private void startAnimation(Context context, View view, float startAngle) {
        ObjectAnimator globeAnimatorClone = (ObjectAnimator)AnimatorInflater.loadAnimator(context, R.animator.rotate_globe);
        globeAnimatorClone.setTarget(mImageView);
        globeAnimatorClone.setCurrentPlayTime(currentTime);
        globeAnimatorClone.start();
}
Run Code Online (Sandbox Code Playgroud)

这不起作用.在19岁之前,有任何人会帮忙请求暂停和恢复动画师为API级别提供的动画吗?

animation android objectanimator

9
推荐指数
2
解决办法
8902
查看次数

如何从停止的值启动Android动画?

我有一个图像视图,我在其上应用旋转动画.动画效果很好.在触摸下,我尝试使用cancel()停止旋转动画,使用reset()重置动画并使用clearAnimation()清除视图上的动画.但动画又恢复了原来的位置.如何使用触发事件发生时的值停止动画并从停止的位置重新启动?

我的动画在xml中定义如下

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

我试图使用以下代码停止动画

private void stopAnimation(){
        mRotateAntiClockwiseAnimation.cancel();
    mRotateAntiClockwiseAnimation.reset();
    imageView.clearAnimation();
    mRotateAntiClockwiseAnimator.end();
    mRotateAntiClockwiseAnimator.cancel();
    stopAnimationForImageButton();
    }
Run Code Online (Sandbox Code Playgroud)

我使用以下代码在视图上设置动画

mRotateAntiClockwiseAnimation = AnimationUtils.loadAnimation(context, R.anim.rotate_anticlockwise);
        mRotateAntiClockwiseAnimation.setFillEnabled(true);
        mRotateAntiClockwiseAnimation.setFillAfter(true);
        imageView.setAnimation(mRotateAntiClockwiseAnimation);
        mRotateAntiClockwiseAnimation.startNow();
        imageView.invalidate();
Run Code Online (Sandbox Code Playgroud)

正如你所看到的,即使使用cancel()或reset()也无助于在动画被触及的位置停止动画.任何指针都会有所帮助

animation android

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

在Git push命令中,在Windows上运行的Jenkins Release工件作业失败

我正在Windows上构建Jenkins作业以自动执行发布过程.因此我使用的是Maven发布插件.

当我在工作中执行Perform Maven Release时,它会要求我提供SCM登录,SCM注释前缀和SCM标记.但是,当执行git push以使用以下日志提交更改时,作业失败.

   [INFO] Checking in modified POMs...
   [INFO] Executing: cmd.exe /X /C "git add -- pom.xml"
   [INFO] Working directory: C:\Program Files (x86)\Jenkins\workspace\Upload REST Release      Artifacts
   [INFO] Executing: cmd.exe /X /C "git status"
   [INFO] Working directory: C:\Program Files (x86)\Jenkins\workspace\Upload REST Release  Artifacts
   [INFO] Executing: cmd.exe /X /C "git commit --verbose -F C:\windows\TEMP\maven-scm-1948138390.commit pom.xml"
   [INFO] Working directory: C:\Program Files (x86)\Jenkins\workspace\Upload REST Release Artifacts
   [INFO] Executing: cmd.exe /X /C "git symbolic-ref HEAD"
   [INFO] Working directory: C:\Program Files (x86)\Jenkins\workspace\Upload REST Release …
Run Code Online (Sandbox Code Playgroud)

git maven maven-release-plugin jenkins

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