小编Sud*_*sri的帖子

在两个布局设置动画时单击"侦听器行为"

我有两个按钮.当按下第一个按钮时,我将我的布局布局翻译到顶部,从屏幕顶部翻译另一个布局.但是我的问题是当回到第一个布局时,第二个布局的点击事件仍然被触发在它以前的位置.那么它的解决方案是什么?我在SO和Google上都找到了很多,但仍然无法得到正确的解决方案.所以请有人帮我解决这个问题.谢谢你.

TranslateAnimation tr1 = new TranslateAnimation(0, 0, 0, -1100);
        tr1.setDuration(1000);
        tr1.setFillAfter(true);
        layout_login.startAnimation(tr1);
        tr1.setAnimationListener(new AnimationListener() {

            public void onAnimationStart(Animation animation) {

            }

            public void onAnimationRepeat(Animation animation) {

            }

            public void onAnimationEnd(Animation animation) {
                layout_signup.setVisibility(View.VISIBLE);
                TranslateAnimation tr2 = new TranslateAnimation(0, 0,
                        -1100, 0);
                tr2.setDuration(1000);
                tr2.setFillAfter(true);
                tr2.setInterpolator(MainActivity.this,
                        android.R.anim.linear_interpolator);
                layout_signup.startAnimation(tr2);

                tr2.setAnimationListener(new AnimationListener() {

                    public void onAnimationStart(Animation animation) {

                    }

                    public void onAnimationRepeat(Animation animation) {

                    }

                    public void onAnimationEnd(Animation animation) {
                        home_activity_btn_login.setEnabled(true);
                    }
                });
            }
        });
Run Code Online (Sandbox Code Playgroud)

android android-layout

8
推荐指数
1
解决办法
1万
查看次数

标签 统计

android ×1

android-layout ×1