androidfirefoxwebviewzoominggeckoview

Is there an alternative to webview setInitialScale in GeckoView in Android


In Webview you can set a zoom scale via a percentage.

I really need to zoom out of a webpage I dont have control of. I cant seem to do the same thing in GeckoView.

I've tried displayDensityOverride(float density) but I can't zoom out only zoom in.

I've tried displayDpiOverride(int dpi) and it doesn't seem to do anything.


Solution

  • Turns out if you include f after the value e.g. displayDensityOverride(0.5f); you can put in values smaller than 1 and it zooms out.

    I must be missing something because it doesn't seem to be documented. https://mozilla.github.io/geckoview/javadoc/mozilla-central/org/mozilla/geckoview/GeckoRuntimeSettings.Builder.html#displayDensityOverride-float-