我能';我看不到android动画,即使我收到通知它已经结束
我一直在尝试在我的Android视图上使用动画-首先使用普通动画,然后使用LayoutImationController。onAnimationEnd()中的代码执行,但我在屏幕上看不到任何移动 这是XML文件我能';我看不到android动画,即使我收到通知它已经结束,android,xml,animation,views,Android,Xml,Animation,Views,我一直在尝试在我的Android视图上使用动画-首先使用普通动画,然后使用LayoutImationController。onAnimationEnd()中的代码执行,但我在屏幕上看不到任何移动 这是XML文件 <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:shareInterpolator="false
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" android:shareInterpolator="false">
<translate>
android:toXDelta="50%"` android:duration="3000" android:fillAfter="true"
</translate>
</set>
你说的
动画触发是什么意思?
我看不到任何移动-我假设我应该看到视图移动。对不起,我的意思是-动画触发的意义是onAnimationEnd()中的代码执行,但我什么也看不到。你能发布你的animation.xml吗?
loginLayOut = (RelativeLayout) findViewById(R.id.login_view);
Animation RightToLeft = AnimationUtils.loadAnimation(this, R.anim.login_screen_animation);
LayoutAnimationController layoutAnimationController = new LayoutAnimationController(RightToLeft);
loginLayOut.setLayoutAnimation(layoutAnimationController);
if (RightToLeft != null) {
RightToLeft.setAnimationListener(new Animation.AnimationListener() {@
Override
public void onAnimationStart(Animation animation) {
}
@
TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)@ Override
public void onAnimationEnd(Animation animation) {
loginLayOut.clearAnimation();
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(
loginLayOut.getWidth(), loginLayOut.getHeight());
lp.setMargins(0, 0, 0, 0);
//lp.addRule(RelativeLayout.ALIGN_PARENT_TOP);
lp.removeRule(RelativeLayout.RIGHT_OF);
lp.addRule(RelativeLayout.CENTER_HORIZONTAL);
loginLayOut.setLayoutParams(lp);
Log.d("Animate", "View has animated");
}
@
Override
public void onAnimationRepeat(Animation animation) {
}
});
loginLayOut.startAnimation(RightToLeft);
}