Comments (3)
So I had a look into this, fiddled around a bit and the problem is indeed the communication between ViewPager2
and NestedScrollWebView
. How ViewPager swiping works, is by intercepting the touch events from its inner views and checking whether the user swiped sideways. Other scrollable views call requestDisallowInterceptTouchEvent(true)
when they do not want parent views to intercept touch events. NestedScrollWebView
does not do this and touch events are handled by the ViewPager. The NestedScrollWebView
's custom scroll handling supports horizontal and vertical scrolling. So calling requestDisallowInterceptTouchEvent(true)
on startNestedScroll()
and requestDisallowInterceptTouchEvent(false)
on stopNestedScroll()
does completely disable ViewPager swiping.
The feature has been broken because ViewPager2
also allows a vertical orientation, while ViewPager(1)
only supports horizontal. So I guess in ViewPager(1)
only vertical scrolling was allowed in the pager tabs and therefore the NestedScrollWebView
.
The documentation says: "ViewPager2 does not natively support nested scroll views in cases where the scroll view has the same orientation as the ViewPager2 object that contains it. [...] To support a scroll view inside a ViewPager2 object with the same orientation, you must call requestDisallowInterceptTouchEvent() on the ViewPager2 object when you expect to scroll the nested element instead."
Solutions are either disabling ViewPager swiping for the selected tab or only allowing to scroll the NestedScrollWebView
vertically.
from xikolo-android.
Hmm, disabling ViewPager swiping only for certain tabs sounds wrong to me and very confusing for users. The drawback of only allowing to scroll the NestedScrollWebView
vertically is that web pages with bad responsiveness cannot be scrolled horizontally anymore, right? The latter sounds okay-ish to me.
from xikolo-android.
Another idea would be to check whether there is "space to scroll" so pages that are already swiped to start allow viewpager swiping. But this would need a lot of custom touch handling.
from xikolo-android.
Related Issues (20)
- Cannot Open LTI Exercises HOT 5
- Improve Error Message When Certificate Cannot Be Opened HOT 2
- Remove/Migrate ShareBroadcastReceiver in Manifest
- llegalStateException for AutoBundles: required fields not found in the bundle HOT 3
- Migrate SharedPreferences to DataStore
- Migrate ButterKnife to ViewBinding
- Cannot Open LTI Exercises, again HOT 3
- Subtitle Support for Cast
- Migrate Realm to Version 10
- Fix unnecessary blank space in collapsing toolbar activities
- [RuntimeException] Image rendering with markwon/glide: trying to draw too large bitmap
- Android 12
- Handle Missing LTI Providers
- Cannot open PDF slides
- Cannot open forum thread linked in the video description HOT 1
- Cannot add an attachment in the forum through the app
- Fold in weeks
- Cannot Open LTI Exercises, again again HOT 1
- openHPI crashes with Android System Webview v113.0.5672.77 or newer
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xikolo-android.