-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android zoom issues #270
Comments
Seems like the following function is the cause of zoom not working if you set `setOnTouchListener(new View.OnTouchListener() {
By commenting out the function. I was able to zoom the page without showing zoom controls. Tested on a Xiaomi Redmi Note 4 - Android 6 |
Huge thanks for pointing it out, I'll try this ASAP. |
Published new version |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug and a minimal reproduction of the issue. |
Environment
Flutter version: 1.12.13+hotfix.5
Plugin version: 3.0.0 9c7ac0d
Android version: Android 8/ 10
Device information: Emulator, OnePlus 3, OnePlus 6T
Description
There're AT LEASE 3 ISSUES related to zoom control on Android platform. (#232, #258, etc)
As I investigate, both of them can be solved with some imperfect solution. I'll explain them below.
For now, zoom on Android is nearly broken.
1. Zoom controls cannot control the zoom behavior
Step to reproduce
displayZoomControls
withtrue
.2. #232, #258
Root cause
The reason why pinch gesture failed infected by two reasons.
setDesktopMode
re-write user defined options.flutter_inappwebview/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/InAppWebView/InAppWebView.java
Lines 653 to 663 in 9c7ac0d
Default value of
preferredContentMode
isRECOMMENDED (0)
, when the code run into this function, it will disabledloadWithOverviewMode
,useWideViewPort
,builtInZoomControls
,supportZoom
no matter what value you set before.displayZoomControls
isfalse
which is by default, the pinch gesture is failed but double tap still worked. I didn't found why this will happened.Solution
So the solution comes clearly.
android/src/main/java/com/pichillilorenzo/flutter_inappwebview/InAppWebView/InAppWebView.java#L653-L663
can be changed to:Then split user agent switcher from
setDesktopMode
for a better UA creation.2. Figure out why
displayZoomControls
takes effect to zoom gestures.The text was updated successfully, but these errors were encountered: