1. *** New version of B4J is available ***
    B4J v7.8
    Dismiss Notice

Android Question Hide Magnifying Glass on Webview

Discussion in 'Android Questions' started by DawningTruth, Aug 16, 2019.

Tags:
  1. DawningTruth

    DawningTruth Active Member Licensed User

    I have looked at the various options and I can't get rid of the webview magnifying glass: [​IMG]

    I am using the following code:

    Code:
    Dim MyWebSettings As WebSettings = MyWebViewExtras.GetSettings

    MyWebSettings.SetSupportZoom(
    True)
    MyWebSettings.SetBuiltInZoomControls(
    True)
    MyWebSettings.SetDisplayZoomControls(
    False)
    My Manifest:

    <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="26"/>

    Any suggestions?
     
  2. JohnC

    JohnC Well-Known Member Licensed User

    Remove the above code and install the "WebView Settings" library, then add this:

    Code:
    Dim wv as WebView '(your webview control)
    Dim wvs As WebViewSettings

    wvs.setDisplayZoomControls(wv,
    False)
     
    DawningTruth likes this.
  3. Douglas Farias

    Douglas Farias Expert Licensed User

  4. DawningTruth

    DawningTruth Active Member Licensed User

    Thx for all the replies. Based on the above advice I am using the following code:

    Code:
    Dim r As Reflector
       r.Target = thisWebview
       r.Target = r.RunMethod(
    "getSettings")
       r.RunMethod2(
    "setSupportZoom"True"java.lang.boolean")
       r.RunMethod2(
    "setBuiltInZoomControls"True"java.lang.boolean")
       r.RunMethod2(
    "setDisplayZoomControls"False"java.lang.boolean")
       r.RunMethod2(
    "setUseWideViewPort"True"java.lang.boolean")
       r.RunMethod2(
    "setLoadWithOverviewMode"True"java.lang.boolean")
    I would think this would be the most direct way of interacting with the webview. I have also tried on two different phones. Still not working.

    Any other suggestions?
     
  5. DawningTruth

    DawningTruth Active Member Licensed User

    Solved it. First tested the above code on a very basic webview only app. It worked perfectly. But still did not work in my app.

    Then made a change in the Designer, and now it works on my app.

    Here is the change I made:

    [​IMG]
    I unchecked the ZoomEnabled box. I think the setting was interfering with the code.
     
    Douglas Farias likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice