Webview zoom not focussed and child view ovelaps - android

I am trying a view similar to conversation view in Inbox app for gmail android app.
They have used RecyclerView for multiple webviews. So I added multiple webviews inside recycler view. The click events are passed to the webview. But I cannot zoom the webview.
Previously I added multiple webviews inside scrollview. I used NonLockingScrollView from here [https://zi.is/p/browser/k-9/src/com/fsck/k9/view/NonLockingScrollView.java?rev=e4d26b8c752f03dc8a40bcb59a0e601835205083] . I was able to zoom correctly, but the adjacent child views are not adjusted according to the zoom.
How can we achieve this effect? Any hint would be greatly helpful. Thanks

I suppose you are looking for built-in zoom support, this would solve that:
WebView web = (WebView) findViewById(R.id.webview);
web.getSettings().setBuiltInZoomControls(true);
web.getSettings().setSupportZoom(true);
Good luck,'.

Related

Android WebView pinchToZoom doesn't work correctly inside ScrollView

I have WebView inside a ScrollView and the WebView zoom functionality doesn't work correctly, because the ScrolView take focus and scrolls instead to zoom WebView.
I was thinking, that putting WebView inside ScrollView isn't the best idea, but unfortunately I don't know how else I can achieve wanted result.
I need to have few TextViews on the top of the screen and under them WebView which will show HTML content, but when I didn't use ScollView I can't see the whole content (scroll down of course).
So anybody has an idea how I can achieve scrolling without ScrollView or zooming WebView in ScrollView correctly?
Thank you!

Scrollable and zoomable view with webviews

Let me start by saying - I know there are quite a lot of posts on this issue. I've been digging and testing it quite a bit, but couldn't come up with the proper solution to my specific requirements.
I need to have a master view with several webviews inside it, and more than one should be visible at a single moment. For this master view - I need to be able to scroll it (to reveal invisible webviews) and to zoom (in order to focus on a single webview).
I've tried TableLayout, but had problems with the zoom (and painting issues with the scrolling). I've tried scroll views, but also read it's not recommended.
Any ideas or recommendation regarding how to achieve this?
Thanks,
yakobom
A simple approach could be to have only one webview with the root html doc containing multiple iframes. Load each page in one of the iframes.
This way the scrolling/zooming could be handled by the webview itself.
Scrollable view can be achieved by adding a scroll view in .xml file and placing remaining text views, edit texts in that scroll view..
to scrolling webview:
mWebView2.getSettings().setJavaScriptEnabled(true);
mWebView2.getSettings().setLoadWithOverviewMode(true);
mWebView2.getSettings().setUseWideViewPort(true);
mWebView2.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
mWebView2.setScrollbarFadingEnabled(true);
to zooming webview:
webView.setInitialScale(50);
webPlanSettings.setDefaultZoom(WebSettings.ZoomDensity.FAR);
webPlanSettings.setUseWideViewPort(true);

scroller button in webview in android

hi as you seen in the image the scroller . i want to implement this one in the web-view how can i develop this feature in the web view .
Thank you .
This is done on ListViews using .setFastScrollEnabled(true);.
It is not supported for WebView, however. That means you'd have to create your own View overlaying the WebView and have some item within it which scrolls your WebView in an OnTouchListener's event.

Android: WebView that is hidden in a ViewFlipper does not apply its WebSettings

I am working on an app that has multiple WebViews in a ViewFlipper. When I try to adjust the font size for all the webviews at the same time (by calling getSettings().setTextSize(TextSize)) only the current view in the flipper updates the font size. I also tried reloading (webView.reload()) the hidden views but it does not work at all.
The closest I have been able to get is by reloading the web views when they become the active view, but then there is a delay of few seconds until the font size updates (and I think page reloading is not a good answer to this anyway...).
Does anyone know how to update all views that are in a ViewFlipper? Thanks for your answers :)
All view inside viewflipper are initiated when you start or create Activity(depend on your code), so on flipping your web view is not updating. You should code inside OnFling() function for webview update, below link, you may looking for that..
Android ViewFlipper not flipping

having trouble with zooming in android webview

I'm new to android. I'm using webview in scrollview to display my local html page (html has text only). I created two buttons for zoomin and zoomout using behind function zoomIn() & zoomOut() respectively. These functions work fine. The problenm is, when I zoom in, some of the text goes out from both top and bottom and it doesn't appear when I scroll.
How can I resolve this?
This question is pretty old, so it's probably answered already, but just in case...
When a WebView zooms, it clips the content to its own view rectangle. From the description of your setup, it sounds like you're scrolling the WebView itself within its parent scroll view. What you want to do is scroll the WebView's contents. You can do this by calling WebView.scrollTo or WebView.scrollBy (inherited from View), or conversely, from within the WebView's JavaScript by calling window.scrollTo.

Categories

Resources