如何禁用滚动型滚动?

由网友(习惯被爱Boy)分享简介:试图解决这个问题:How从听触摸我不知道它有一个解决方案,以阻止从处理onTouchEvents滚动型没有为它创建自定义的类禁用pullToRefreshScrollView?为什么像所有的methos Trying to resolve this issue : How to disable pullToRefr...

试图解决这个问题:How从听触摸我不知道它有一个解决方案,以阻止从处理onTouchEvents滚动型没有为它创建自定义的类禁用pullToRefreshScrollView? 为什么像所有的methos

Trying to resolve this issue : How to disable pullToRefreshScrollView from listening to touch I am wondering it there is a solution, to block ScrollView from handling onTouchEvents without creating customizable class for it ? Why all the methos like

gridView.getParent().requestDisallowInterceptTouchEvent(true);

mScrollView.setOnTouchListener(new OnTouchListener() {
           @Override
           public boolean onTouch(View v, MotionEvent event) {
              return false;
           }
        });

不工作?什么是他们的问题?为什么谷歌实现方法不工作?

doesn't work ? what's the problem with them ? why Google implements methods which doesn't work ?

推荐答案

//获取滚动型

final ScrollView myScroll = (ScrollView) findViewById(R.id.display_scrollview);

//禁用滚动通过建立一个OnTouchListener做什么

// Disable Scrolling by setting up an OnTouchListener to do nothing

myScroll.setOnTouchListener( new OnTouchListener(){ 
    @Override
    public boolean onTouch(View v, MotionEvent event) {
        return true; 
    }
});

//启用滚动通过删除OnTouchListner

// Enable Scrolling by removing the OnTouchListner

tvDisplayScroll.setOnTouchListener(null);    
阅读全文

相关推荐

最新文章