Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/200.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android animationlistener未在蜂窝设备前工作_Android_Animation_Listener_Android 3.0 Honeycomb - Fatal编程技术网

Android animationlistener未在蜂窝设备前工作

Android animationlistener未在蜂窝设备前工作,android,animation,listener,android-3.0-honeycomb,Android,Animation,Listener,Android 3.0 Honeycomb,我想将动画应用于视图,并在动画通过AnimationListener结束时显示它。我的代码适用于设备4.x,但不适用于2.3.3设备,onAnimationStart和onAnimationEnd方法从未被调用 final Animation toTopAnimation = AnimationUtils.loadAnimation(getActivity(), R.anim.move_up); toTopAnimation.setDuration(250); toTopAnimation

我想将动画应用于视图,并在动画通过AnimationListener结束时显示它。我的代码适用于设备4.x,但不适用于2.3.3设备,onAnimationStart和onAnimationEnd方法从未被调用

 final Animation toTopAnimation = AnimationUtils.loadAnimation(getActivity(), R.anim.move_up);
 toTopAnimation.setDuration(250);
 toTopAnimation.setFillBefore(true);
 toTopAnimation.setFillAfter(true);

 toTopAnimation.setAnimationListener(new AnimationListener() {
     @Override
     public void onAnimationStart(Animation animation) {
          Log.i("log", "onAnimationStart");
     }
     @Override
     public void onAnimationEnd(Animation animation) {
         Log.i("log", "onAnimationEnd");
         mQuickReturnView.setVisibility (View.VISIBLE);
     }

     @Override
     public void onAnimationRepeat(Animation animation) {
     }
 });

  mQuickReturnView.setAnimation(toTopAnimation);
  mQuickReturnView.startAnimation(toTopAnimation);
你能看出什么不对劲吗


谢谢

我遇到了一个类似的问题,并设法解决了它。我仍然不确定这个问题背后的原因是什么,但它存在于视图的内容和姜饼处理绘图的方式周围

在我的例子中,我有一个
RelativeLayout
,其中包含一些视图。只有在调用动画之前,我在RelativeLayout中更改了子视图的某些值,动画才会工作。例如,我的内部有一个
TextView
,因此我将调用
setText()
方法。也许你也应该试试:

// ---
mQuickReturnView.setAnimation(toTopAnimation);
someViewInsidemQuickReturnView.setText(getResources().getString(R.string.some_string));
mQuickReturnView.startAnimation(toTopAnimation);
// ---

setText()。在我看来,这个问题到处都是,但setText()对我不起作用,但问题是类似的。在我的例子中,我通过在布局中隐藏一些内容来解决它。