简体   繁体   English

触发ontouchlistener时禁用listview滚动

[英]disable listview scrolling when ontouchlistener is fired

i attached a ontouch listener to my listview so i can drag the listview left to right. 我将一个ontouch侦听器附加到我的列表视图,因此我可以将列表视图从左到右拖动。 While im dragging the listview im able to scroll it as well. 当我拖动列表视图时,我也可以滚动它。 How can i disable the listview scroll while i'm dragging it. 拖动时如何禁用列表视图滚动。

listView.setOnTouchListener(new OnTouchListener() {

    public boolean onTouch(View v, MotionEvent event) {
        if (event.getAction() == MotionEvent.ACTION_MOVE) {
            return true; // Indicates that this has been handled by you and will not be forwarded further.
        }
        return false;
    }
});

OR 要么

listView.setScrollContainer(false);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM