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.
Related
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.
I'm using a TextureView to show a cropped video by setting a scale-matrix with setTransform(matrix) like in this tutorial. So the video gets larger than the view itself.
This works fine for all android versions except for KitKat (4.4).
The problem I have here is that the TextureView's content is not cropped at the view-bounds - it draws the cropped-away part of the video too. However, the outside part is only updated when the layout refreshes (scroll).
A cropped video (nature.mp4) should look like this:
This is what it looks like on KitKat (I'm showing layout bounds in this screenshot):
I tried setting clip-bounds to the view-bounds via setClipBounds(..) - that's not working. Also, I can't use Canvas.clipRect(..) since TextureView's draw-method is final.
It's clearly a bug with KitKat, but has anyone an idea for a workaround?
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);
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
I am testing a mobile site at the moment on android and have noticed that all my transparent images that have a shadow at the bottom are all rendering extremely poorly. I have tried adding noise>0.5>uniform>monochromatic to the image to solve this but this hasnt helped at all i also tried adding noise>2.0>gausiann>monochromatic but again got no change.
its clear that the image is being rendered as png8 even though im saving out the image as png24. i am also using the most up to date version of the android browser 2.3.3
Can anyone shine any light on this problem?
I know its old but the solution is here.
To summarize: Use following code in onCreate(), between super.onCreate() and setContentView() in your activity:
getWindow().setFormat(PixelFormat.RGBA_8888);