NineOldAndroids,旋转或移动后无法点击查看 [英] NineOldAndroids, not clickable view after rotation or move

查看:136
本文介绍了NineOldAndroids,旋转或移动后无法点击查看的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 NineOldAndroids 2.4.0动画对象 主要表现为运动和控制的转变。 在Android 4.0及以上的所有工作正常,但对动画元素后,previous版本为2.1(2.3)不接收焦点也不要点击。 样品code:

I use NineOldAndroids 2.4.0 to animate objects mainly for the movement and transformation of control. On Android 4.0 and above all works fine,but on previous versions (2.1, 2.3) after the animation elements do not receive focus and do not clickable. Sample code:

View v = findViewById(R.id.button1);
v.setOnClickListener(new OnClickListener() {

     @Override
     public void onClick(View v) {
        Toast.makeText(MainActivity.this, "Click!", Toast.LENGTH_SHORT).show();
     }
});
ObjectAnimator moveDown = ObjectAnimator.ofFloat(v, "translationY", 100f);
moveDown.setDuration(5000);
moveDown.start();

这是在图书馆或什么我做错了一个错误?如果这 库不支持蜂窝动画API的所有功能,然后在我的项目,这将是无用的。

This is a bug in the library or something I'm doing wrong? If this library does not support all the functionality of "Honeycomb animation API", then in my project, it will be useless.

报价: 的由于该系统实际上是在目标对象改变属性,对象本身被改变,而不是简单它们的外观。所以这个按钮,你将被实际移动,不只是画在不同的地方。你甚至可以单击它在它的动画位置。来吧,点击它;我敢说你。

推荐答案

现在我找到了答案: <一href="http://stackoverflow.com/questions/9595881/how-to-do-interactive-animation-translation-with-android">How做交互动画(翻译)与Android

now i found the answer: How to do interactive animation (translation) with Android

它说,nineoldandroids得到了同样的限制,原生SDK。

it says that nineoldandroids got the same limitations as the native SDK.

所以我的解决办法:

myAnim.setListener(new AnimatorListenerAdapter() {
  @Override
  public void onAnimationEnd ( Animator nullPointer ) {
    RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) child.getLayoutParams();
    params.bottomMargin += toYDelta;
    params.leftMargin += toXDelta;
    child.setLayoutParams(params);
  }
});

这篇关于NineOldAndroids,旋转或移动后无法点击查看的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆