Recent

Author Topic: [SOLVED] Set zoom for Webview  (Read 786 times)

maurobio

  • Hero Member
  • *****
  • Posts: 623
  • Ecology is everything.
    • GitHub
[SOLVED] Set zoom for Webview
« on: May 20, 2023, 10:05:15 pm »
Dear ALL,

I'm using a webview in my (very simple) Android app, which is displayed when the app is started. But the website is zoomed in quite a lot, and I want it to be zoomed out to fit the width of the screen. How can I achieved that?

I found a lot of tips for doing it in Java, like a call to 'jWebView.setInitialScale(ZOOM_LEVEL);', but this does not appear to work with LAMW.

Thanks in advance for any assistance you can provide.

With warmest regards,
« Last Edit: May 21, 2023, 01:24:33 pm by maurobio »
UCSD Pascal / Burroughs 6700 / Master Control Program
Delphi 7.0 Personal Edition
Lazarus 2.0.12 - FPC 3.2.0 on GNU/Linux Mint 19.1, Lubuntu 18.04, Windows XP SP3, Windows 7 Professional, Windows 10 Home

jmpessoa

  • Hero Member
  • *****
  • Posts: 2301
Re: Set zoom for Webview
« Reply #1 on: May 21, 2023, 02:07:12 am »
You can try:

Code: Pascal  [Select][+][-]
  1. procedure TAndroidModule1.AndroidModule1JNIPrompt(Sender: TObject);
  2. begin
  3.         WebView1.SetLoadWithOverviewMode(True);
  4.         WebView1.SetUseWideViewPort(True);
  5. end;
  6.  


Edited:  added  "SetInitialScale",  but not tested....
« Last Edit: May 21, 2023, 09:26:11 am by jmpessoa »
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

maurobio

  • Hero Member
  • *****
  • Posts: 623
  • Ecology is everything.
    • GitHub
Re: Set zoom for Webview
« Reply #2 on: May 21, 2023, 01:24:14 pm »
Hi, @jmpessoa!

Thanks, it works fine!

With best regards,
UCSD Pascal / Burroughs 6700 / Master Control Program
Delphi 7.0 Personal Edition
Lazarus 2.0.12 - FPC 3.2.0 on GNU/Linux Mint 19.1, Lubuntu 18.04, Windows XP SP3, Windows 7 Professional, Windows 10 Home

 

TinyPortal © 2005-2018