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();
Run Code Online (Sandbox Code Playgroud)
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.
报价上的Android开发者博客"在蜂巢动画": 由于目标对象的系统实际上是改变性质,对象本身的改变,不只是它们的外观.因此,您移动的按钮实际上是移动的,而不仅仅是在不同的地方绘制.您甚至可以在其动画位置单击它.继续点击它; 我赌你.
现在我找到了答案: 如何使用Android进行交互式动画(翻译)
它说九个机器人与原生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);
}
});
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
4239 次 |
最近记录: |