I have app android WebApp inside SwipeRefreshLayout. Problem is when I scroll down webview, SwipeRefreshLayout trigers and I am not able to scroll down webview it self.
My target: SwipeRefreshLayout to triger only from green area but still remain 100% of screen. Green Area is part of webview.
Update Css of the webpage to support webview touch scroll detect,
mostly in the case overflow property conflicts with the android swipe refresh layout. You can read further on such issues here:
SwipeRefreshLayout + WebView when scroll position is at top
or you can use webview javascript Bridge for this to resolve.
Related
So I have my activity (extending CordovaActivity) on Android, which loads the content, but I am unable to scroll.
I already tried to add this code into my activity:
// Display vertical scrollbar and hide horizontal scrollBar
super.appView.getView().setVerticalScrollBarEnabled(true);
super.appView.getView().setHorizontalScrollBarEnabled(false);
// set scrollbar style
super.appView.getView().setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
but didn't help.
Does anyone has an experience / solution to How can I make my Cordova WebView scrollable?
I have a Custom Horizontal Scroll View in a Html page , now this horizontal scrolling based on java script library , now when i load the html pager in a webview i cant scroll horizontally because the viewpager take the touch event to move between pages .
You will need to implement onInterceptTouchEvent(MotionEvent), determine if the touch is within the horizontal scroll section of your WebView, and then call requestDisallowInterceptTouchEvent(boolean) on the parent of the WebView (assuming that is the ViewPager).
Determining if the touch is within the horizontal scroller may be tricky, but you can probably accomplish that with some JS callbacks that the WebView listens for.
Before all of that, you may want to consider the UX implications of this though. It may be confusing / disorienting to the user to have horizontal scrolling content in a horizontal scrolling view.
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.
I have a view hierarchy like this, a vertical ScrollView with a vertical LinearLayout containing two children:
ScrollView ->orientation:vertical, width:fill_parent, height: fill_parent
LinearLayout -> orientation:vertical, width:fill_parent, height: fill_parent
WebView -> width:fill_parent, height: fill_parent
GoogleAdView -> width:wrap_content, height:wrap_content
When scrolling to the bottom of the webview and clicking on any link there, though the page loads , the scrollbar stays at the bottom rather than moving to the top. I can programatically set the scroll using scroll.fullScroll(ScrollView.FOCUS_UP), but that causes the scrollbar to jump up visibly. I have tried hiding the scrollbar before the page loads with scrollView.setVerticalScrollBarEnabled(false) and then re-enabling it after the page loads before calling scroll.fullScroll(ScrollView.FOCUS_UP) but that still causes the scrollbar to "jump".
The WebView by itself handles scrolling much more nicely on page changes, looks like it hides the scrollbar and then makes it appear on top of the page after load. Is there a way to maintain this with ScrollView?
You cannot reliably put a WebView in a ScrollView.
Either embed your ad in your Web content, leave the banner fixed on the screen, or work out some other trigger to animate hiding the ad (e.g., goes away after 5 seconds).
I've solved this by adding the AD inside the webview. Unfortunately you won't be able to use any Ad network SDK's, but it's a much better user experience.
Use javascript injection to insert your ads after the webview loads.
The trick is to use loadDataWithBaseURL when loading content into the WebView. Simply doing a loadData doesn't cause the scroll offset to reset.
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.