ListView 禁止滑动和点击

时间:2014-10-28 17:14:16   收藏:0   阅读:558
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的滑动和点击事件屏蔽
评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!