好吧我仍然真的很挣扎(请参阅我之前的问题here),我需要气球漂浮在屏幕上,这样它们从屏幕下方升起并略微曲折,因为它们上升我已实现这一点对象动画师,虽然我非常接近,结果因屏幕而异(稍微)这里是我所拥有的片段 LEFT BALLOON
ObjectAnimator sqbalAnim3 =
ObjectAnimator.ofFloat(rb,"x",0f,100f);
sqbalAnim3.setDuration(700);
sqbalAnim3.setRepeatCount(6);
sqbalAnim3.setRepeatMode(ValueAnimator.REVERSE);
ObjectAnimator sqbalAnim =
ObjectAnimator.ofFloat(rb,"y",1000f,0f);
sqbalAnim.setDuration(7000);
sqbalAnim.setRepeatMode(ValueAnimator.RESTART);
AnimatorSet animSetXY = new AnimatorSet();
animSetXY.playTogether(sqbalAnim, sqbalAnim3);
animSetXY.setStartDelay(5);
animSetXY.start();
右气球
ObjectAnimator sqbal2Anim =
ObjectAnimator.ofFloat(findViewById(R.id.rectballoon2),"y",1000f,0f);
sqbal2Anim.setDuration(7000);
sqbal2Anim.setRepeatMode(ValueAnimator.RESTART);
ObjectAnimator sqbalAnim4 =
ObjectAnimator.ofFloat(findViewById(R.id.rectballoon2),"x",400f,500f);
sqbalAnim4.setStartDelay(5);
sqbalAnim4.setDuration(700);
sqbalAnim4.setRepeatCount(6);
sqbalAnim4.setRepeatMode(ValueAnimator.REVERSE);
AnimatorSet animSetXY2 = new AnimatorSet();
animSetXY2.playTogether(sqbal2Anim,sqbalAnim4);
animSetXY2.start();
return true;
}
这些值使它看起来非常类似于我正在寻找但它有一些或毛刺。 1)气球视图出现在其起始点(来自XML),然后消失并启动动画 2)不同屏幕上的气球视图明显不同。 所以我的问题是;无论如何我可以调整我必须使它在设备之间更加一致(并不需要精确)他们只需要从底部到顶部浮动稍微曲折,直到它们到达屏幕顶部附近他们爆。任何和所有建议欢迎