ListView 禁止滑动和点击

public boolean dispatchTouchEvent(MotionEvent ev) {
        if(oneTouchDesable){
            
            if(!contains((int)ev.getX(), (int)ev.getY())){
                if(ev.getAction() == MotionEvent.ACTION_UP){
                    oneTouchDesable = false;
                }else if(ev.getAction() == MotionEvent.ACTION_DOWN){
                    if(touchStatusListener!=null){
                        touchStatusListener.oneTouchDesable();
                        lastX =-1;
                    }
                }
            }
            return true;
        }
        return super.dispatchTouchEvent(ev);
    }

 

重新listView的

dispatchTouchEvent 事件根据条件屏蔽到响应的触摸事件就可以实现ListView的滑动和点击事件屏蔽
posted @ 2014-10-28 15:45  骑着毛驴上京城  阅读(840)  评论(0编辑  收藏  举报