Android Question Hide Webview Zoom Controls but still have zoom

tsteward

Well-Known Member
Licensed User
Longtime User
Is it possible to turn off the + & - zoom buttons on a webview but still have pinch zoom.

If I turn off zoom in the designer the buttons are gone but can no longer pinch zoom.
If I leave it on in designer and use the webviewsettings library I have tried
setDisplayZoomControls does not have any effect.
setSupportZoom will turn zoom control off completely.

Again I want zoomability just not the buttons displayed.

Thanks
Tony
 

tsteward

Well-Known Member
Licensed User
Longtime User
Thank you Erel,
After adding your code above I get the following error
java.lang.RuntimeException: Method: setBuiltInZoomControls not found in: android.webkit.WebView
 
Upvote 0

kisoft

Well-Known Member
Licensed User
Longtime User
HI
I added this code to my project and I get this error.
B4X:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Cannot get methods of class: com.android.webview.chromium.ContentSettingsAdapter, disabling cache.
Error occurred on line: 36 (Main)
java.lang.ClassNotFoundException: com.android.webview.chromium.ContentSettingsAdapter
    at java.lang.Class.classForName(Native Method)
    at java.lang.Class.forName(Class.java:453)
    at java.lang.Class.forName(Class.java:378)
    at anywheresoftware.b4j.object.JavaObject$MethodCache.getMethod(JavaObject.java:342)
    at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:119)
    at kamil.sc.main._activity_create(main.java:403)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:738)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:360)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:260)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
    at kamil.sc.main.afterFirstLayout(main.java:104)
    at kamil.sc.main.access$000(main.java:17)
    at kamil.sc.main$WaitForLayout.run(main.java:82)
    at android.os.Handler.handleCallback(Handler.java:789)
    at android.os.Handler.dispatchMessage(Handler.java:98)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6710)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
 
Upvote 0

BlueVision

Active Member
Licensed User
Longtime User
Really sorry for reopening this, but posting somewhere else rises the fragmentation of valueable information in this case. It belongs directly to this topic...

Have some problems with this. I am using multiple webviews within my program, looks to me that the code above only works on a single webview within the application. It fails if I use this code multiple times on different webviews (adressed with a different reflector). The code only affects the last webview adressed... Would be really nice to get this fixed, because the zoom controls in my case hiding to much information, this is really annoying...
Any ideas? Until now I did not tried to use the code again directly before accessing the affected webviews. Maybe this is the workaround?

Cheers BV
 
Upvote 0

BlueVision

Active Member
Licensed User
Longtime User
Fixed in the following way (there is always a simple solution...)
When creating layouts with the designer, simply remove the hook for zoomcontrol for the webview affected. Controlling it by code in the way above does not work.
 
  • Like
Reactions: eps
Upvote 0
Top