setLoadWithOverviewMode for XWalkView - android

Is there any equivalent function in XWalkView for setLoadWithOverviewMode?
I am working on a Android application that load a website in a XWalkView. The view zooms in the top left corner of the website when it loaded. I couldn't find anyway to set the initial zoom level of the XWalkView. As for the android webview, i used setLoadWithOverviewMode for the job, but the xwalk 11 library does not support getSetting() method anymore.
Help would be very much appreciated.
Sorry for my bad english.

In latest versions (I'm on 20.50.529) you can use this to get an initial zoom of 100%
XWalkView webView=new XWalkView(this);
webView.getSettings().setInitialPageScale(100);

Related

Android Oreo WebView renders layout too small after 2nd loading

On some Android Oreo devices, when I load an url on webview for the first time, the URL page loads properly. However, when I load the URL again, the page is zoomed out. On devices lower than android oreo, the page loads properly for all devices.
Also, when you kill the app on the background and load again, the URL loads properly. On the second and succeeding tries, it shows the zoomed out version again. I attached the images of loaded URL below
Below is the correct loading of webpage on the webview
Below is the small display of webpage on webview webview
Android XML Code:
<WebView
android:id="#+id/content_view"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
Java Code:
private WebView mWebView;
mWebView = (WebView) view.findViewById(R.id.content_view);
mWebView.loadUrl("https://policies.google.com/");
URL: https://policies.google.com/
Take note that this happen in other URLs too. https://policies.google.com/ is just an example
It works on the following:
Huawei nova 2i RNE-L22, Android 8.0.0
It DOES NOT work on the following
Android 8.1.0; Pixel 2
Android 8.0.0; Samsung SM-G950FD
Android 8.0.1; Huawei P20 EML-L29
Any suggestions or reasons as why this happens? How to fix this?
Thanks in advance.
if you have problems related to zoom in webview
try to add zoom in and zoom out functions to your webview
you can add these lines to your java code, to implement zooming in and out
mWebView.loadUrl(url);
//code for zooming functions
webview.getSettings().setBuiltInZoomControls(true);
webview.getSettings().setSupportZoom(true);
//for javascript
webView.getSettings().setJavaScriptEnabled(true);
After asking google team about this issue,
the said that it's probably some viewport layout settings. Webview has some unfortunate defaults due to legacy issues.,
Adding webview.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.TEXT_AUTOSIZING); fixed the issue.

WebView/KitKat Devices/Text auto resizing Issue

I am working with WebView, and i am getting issue when i am testing my app on KitKat(4.4.2) version devices.
My Issue is:
When i call method findNext(), the text content of Webview gets zoom in and zoom out alternatively.
Please help.

Fill web view with HTML page without scrolling

I am using web view to load HTML page which as background image (827 x 1102), I trying to wrap the content within the given height and width of the webView and I don't want to scroll the content at initial stage by exploring regarding this I came to know about below lines of code
mwebview.getSettings().setLoadWithOverviewMode(true);
mwebview.getSettings().setUseWideViewPort(true);
The above code is working fine on 2.2, 2.3.3 but it is adding extra space on 3.0 and higher version, you can check the attached images on different version.
I even tried by appending
<head><meta name=viewport content=target-densitydpi=device-dpi/></head>
In html file but no luck.
Motorla Xoom 3.0
Samsugn Tab 2.3.3
Any help will be appreciated
Thank you in Advance

How to create imageview with zoom and pan functionality?

I created an app that has a small image loaded from URL of a website. I want that when user clicks on that small image it'll show the image in full screen and will also have the ability to zoom and pan that image.
What I've done was showing the image in WebView with built-in zoom controls but the result was ugly. (I've set the layout to wrap_content so no white areas are shown, but it cause the image doesn't zoom dynamically).
Any solution? and sorry for my bad English.
Problem solved! For anyone who have the same problem, I've use this library and it works great! http://blog.sephiroth.it/2011/04/04/imageview-zoom-and-scroll/
Here's a link to the Github ImageViewZoom page.
You can build that from scratch or... you can use this library:
http://code.google.com/p/android-pinch
Take a look at the PinchImageView class
You need to use GestureDetectors. Google has excellent sample interactiveChart for this, see https://android.googlesource.com/platform/development/+/master/samples/training/InteractiveChart
and http://developer.android.com/training/gestures/scroll.html

using pinch in the webview android

I have two questions:
I find this code to use pinch in the webImageView but when I change webImageView by WebView. I obtain an error in the code. how I use pinch in the webview??
// create the WebImageView object from xml
WebImageView img = (WebImageView) findViewById(R.id.main_pic);
// fetches the image in a background thread
img.setImageFromURL("http://www.mysite.com/mypicture.jpg");
// enable pinch-zoom abilities on the image
new PinchImageView(img);
When I add pinch in my code is that supported by all the mobile android or you should have a specific screen to make it work it.
You can enable zooming in a WebView by following WebView setting
mWebView.getSettings().setBuiltInZoomControls(true);
Also you can set the default zoom level by using ZoomDensity
mWebView.getSettings().setDefaultZoom(WebSettings.ZoomDensity.CLOSE);
Have you added the referencing library of Nikko?
http://code.google.com/p/android-pinch/wiki/PinchImageView

Categories

Resources