zoukankan      html  css  js  c++  java
  • android 位移动画移动后原地绑定的点击事件还在

    今天为一个系统左侧的菜单栏设置了一个点击事件,设置了translateAnimation以后发现,当位移动画结束以后,菜单里边的button的onclick事件还在,不得不感慨这点官方做得实在够脑残,于是自己又加了一个控制view显隐的代码,最后代码是这样的:

        private void startHideAnimation(){
            if (isexpand==true) {
                Animation hideAnimation = new TranslateAnimation(0, -menuLayoutWidth, 0, 0);
                hideAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
                hideAnimation.setDuration(800);
                hideAnimation.setFillAfter(true);
                hideAnimation.setAnimationListener(new AnimationListener() {
                    
                    @Override
                    public void onAnimationStart(Animation animation) {
                        // TODO Auto-generated method stub
                        
                    }
                    
                    @Override
                    public void onAnimationRepeat(Animation animation) {
                        // TODO Auto-generated method stub
                        
                    }
                    
                    @Override
                    public void onAnimationEnd(Animation animation) {
                        // TODO Auto-generated method stub
                        menuLayout.setVisibility(View.GONE);
                    }
                });
                menuLayout.startAnimation(hideAnimation);//直接设置的话,menulayout虽然从视野消失,但是原地点击的效果还在
                
            }
            isexpand = false;
        }
        private void startShowAnimation(){
            if (isexpand==false) {
                Animation showAnimation = new TranslateAnimation(-menuLayoutWidth, 0, 0, 0);
                showAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
                showAnimation.setDuration(500);
                showAnimation.setFillAfter(true);
                
                menuLayout.startAnimation(showAnimation);
                menuLayout.setVisibility(View.VISIBLE);
            }
            isexpand = true;
        }
  • 相关阅读:
    项目管理软件选择:redmine or JIRA
    为已编译的DLL附带强命名
    NET简单的一个画图程序
    公共的Json操作类
    ASP.NET 程序优化
    提高ASP.NET页面载入速度的方法
    DataTable快速定制之Expression属性表达式
    TCP和UDP Client 代码
    Jquery实现异步上传图片
    C语言Socket编程(计算机网络作业)
  • 原文地址:https://www.cnblogs.com/gangmiangongjue/p/4680031.html
Copyright © 2011-2022 走看看