WebView Zoom and Scale

canalrun

Well-Known Member
Licensed User
Longtime User
In the android SDK documentation for android.webkit (I assume this is interfaced to by WebView), I see the two methods: public float getScale () and public void setInitialScale (int scaleInPercent). I am guessing these are related to the methods Zoomin and Zoomout and the WebView method for zooming.

Can I access these methods from B4A - maybe with agraham's Reflection library? Will they return something related to the zoom factor?

Thanks,
Barry.
 

canalrun

Well-Known Member
Licensed User
Longtime User
In the android SDK documentation for android.webkit (I assume this is interfaced to by WebView), I see the two methods: public float getScale () and public void setInitialScale (int scaleInPercent). I am guessing these are related to the methods Zoomin and Zoomout and the WebView method for zooming.

Can I access these methods from B4A - maybe with agraham's Reflection library? Will they return something related to the zoom factor?

Thanks,
Barry.

Holy donuts that was easy!

B4X:
Dim Obj1 As Reflector
Dim s As String
Dim f As Float

Obj1.Target = WvMain
s = Obj1.TypeName
f = Obj1.RunMethod("getScale")

wvMain is my WebView

elsewhere in the code I have:

B4X:
Obj1.Target = WvMain
Obj1.RunMethod2("setInitialScale", "200", "java.lang.int")

Thanks for the Reflection Library.

Barry.
 
Upvote 0
Top