子控制元件呼叫 requestDisallowInterceptTouchEvent(true) 無效 #906
子控制元件呼叫 requestDisallowInterceptTouchEvent(true) 無效#906
chiemyopened this issueon 16 May 2019· 5 commentsComments
chiemycommentedon 16 May 2019•
edited
自定義了一個控制元件,在 onTouchEvent 的 ACTION_DOWN 事件裡呼叫 requestDisallowInterceptTouchEvent(true),事件還是被攔截了,使用官方 SwipeRefreshLayout 則沒有這個問題 |
scwang90commentedon 25 May 2019
能提供一下你的應用場景嗎?給一個demo 程式碼,可以更高更快的解決這個問題。 |
hoop208commentedon 14 Aug 2019•
edited
有這樣一個場景:SmartRefreshLayout裡面的內容需要支援長按後繪製當前手指移動的座標(比如股票的分時圖折線圖).呼叫requestDisallowInterceptTouchEvent(true)只是設定了mGroupFlags的標記位.SmartRefreshLayout在重寫dispatchTouchEvent的時候好像沒有對mGroupFlags |= FLAG_DISALLOW_INTERCEPT的情況做處理. 佈局檔案:
長按後需要繪製座標的控制元件:
|
WoKeecommentedon 25 May 2020
if (mSuperDispatchTouchEvent) {//如果父類攔截了事件,傳送一個取消事件通知 |
scwang90commentedon 27 May 2020
新增 android:nestedScrollingEnabled="true" 即可
|
WoKeecommentedon 27 May 2020
<ViewFlipper recyclerview 使用 BaseQuickAdapter.addFooterView(ViewFlipper) ; |