Android 翻译动画问题

Android 翻译动画问题,android,android-layout,android-animation,Android,Android Layout,Android Animation,我想从屏幕的特定X Y位置通过平移动画制作一个布局动画。这种情况发生得非常正确。现在,当动画再次完成布局时,问题开始出现。请转到屏幕的上角。我希望布局保持在动画结束的相同位置 AnimationListener animationListener = new AnimationListener() { @Override public void onAnimationEnd(Animation arg0) { drawer_layout

我想从屏幕的特定X Y位置通过平移动画制作一个布局动画。这种情况发生得非常正确。现在,当动画再次完成布局时,问题开始出现。请转到屏幕的上角。我希望布局保持在动画结束的相同位置

 AnimationListener animationListener = new AnimationListener() {

        @Override
        public void onAnimationEnd(Animation arg0) {
            drawer_layout.setVisibility(View.VISIBLE);

        }

        @Override
        public void onAnimationRepeat(Animation animation) {
            // TODO Auto-generated method stub

        }

        @Override
        public void onAnimationStart(Animation animation) {
            drawer_layout.setVisibility(View.VISIBLE);

        }

    };

    final Animation animTranslate = AnimationUtils.loadAnimation(this,
            R.anim.top_to_bottom_in);

    animTranslate.setAnimationListener(animationListener);

    drawer_layout = (LinearLayout) findViewById(R.id.drawer_layout);
    button.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            // bitmapBackground = CaptureBackground();

            faded_layout.setBackgroundColor(Color.parseColor("#50ffffff"));

            // HandleDropAnimation(drawer_layout);
            drawer_layout.startAnimation(animTranslate);
        }
    });
这是我的xml

<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="1000"
android:fromYDelta="25%p"
android:toYDelta="50%p" />

呼叫

animTranslate.setFillAfter(true)

在开始动画之前。根据:

如果fillAfter为true,则此动画执行的变换将在完成时保持不变

召唤

animTranslate.setFillAfter(true)

在开始动画之前。根据:

如果fillAfter为true,则此动画执行的变换将在完成时保持不变


在动画开始之前使用

animTranslate.setFillAfter(true);

在动画开始之前使用

animTranslate.setFillAfter(true);
欢迎:)如果你认为你的问题已经解决,请接受这个答案。欢迎:)如果你认为你的问题已经解决,请接受这个答案。