Android-NestedDetail icon indicating copy to clipboard operation
Android-NestedDetail copied to clipboard

外层要是支持SwipeRefreshLayout就好了

Open androidTH opened this issue 6 years ago • 1 comments

androidTH avatar Jun 24 '19 08:06 androidTH

可以通过重写 SwipeRefreshLayout 的 onInterceptTouchEvent() 方法来实现支持。

参考如下代码:

    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        boolean isIntercept = true;
        switch (ev.getAction()) {
            case MotionEvent.ACTION_DOWN:
                mDownY = (int) ev.getY();
                break;
            case MotionEvent.ACTION_HOVER_MOVE:
                int dy = (int) (mDownY - ev.getY());
                if (dy > 0) isIntercept = false;
        }
        return mWebView.getScrollY() == 0 &&
                mScrollView.getScrollY() == 0 &&
                isIntercept && 
                super.onInterceptTouchEvent(ev);
    }

linzhengloser avatar Jul 09 '19 03:07 linzhengloser