I have multiple WebViews showed in ViewPager, as pages, but i faced a problem if part of WebView content is Horizontal Scrollable content, I have tested it on iOS, and the WebView consume the TouchEvent, so the ViewPager doesn't scroll, but in android the ViewPager keeps scrolling, I tried to get the consume the TouchEvent, but I couldn't determine if the content is horizontal scrollable or not.
====
Edit 1:
the width of the content matches the webview, without scrollbars, but they put frame or i dont know what its name, the content inside it is horizontal scrollable. (Interactive Magazine)
Little sample online http://www.quackit.com/html/codes/horizontal_scroll.cfm (scroll down to result box)
Related
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.
I need to place a android.widget.Gallery inside a view pager at the bottom. The user will read and scroll all the way to the bottom and than see more pictures to view inside the Gallery at the bottom. I want to be able to scroll horizontally through the Gallery w/o switching pages. So when the user is interacting with the Gallery, I don't want the horizontal swipe of the ViewPager to take over and switch pages. How can this be done?
I don't recommend horizontal scrolling item in a horizontal scrolling viewpager.
To try this you have a couple options, lots of items: 1.) search horizontal list view. less items: 2.) horizontal scrollview. I guess option 3.) use gallery even though depreciated.
However, I encourage you to try it, it just doesn't work very well with two items scrolling the same way.
For the same reason it's not a good idea to have a vertical scroll inside another vertical scroll.
About the only way this can work is if you give the user a separate full screen non-horizontally scrolling window with your horizontally scrolling item.
I am developing Android application which contains the reading of epub books. In that I need to place two pages in book view. If those pages exceed the screen size user have to scroll and view the books and have to pinch zoom the book and user can pan the book for reading.
At first I tried to place two webview inside the Relativelayout. I can achieve this by placing relativelayout inside the scrollview and horizontal scrollview to scroll in both horizontal and vertical.
But problem occur in the swipping of pages and pinchzoom is not working inside the scrollview; it remains in the first page itself. I don't know where I am going wrong.
Are you putting WebView inside ScrollView? It functions funny that way. You'll have to disable the outside ScrollView if you're doing so.
You can modify ScrollView to be lockable, as in here.
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 have problem in scrolling of webview vertically when it's scrolled along vertically,where this webview is with in scrollview tag,how can i enable the scrolling for webview and to disable the scrolling of whole layout when its on webview contained layout.
Because of the way touch events are consume in android it is not recommended or even really possible to have two Views that consume and react to the same move events in the same axis. In other words, you cannot put a WebView in a ScrollView. You would not be able to put a ListView in a ScrollView and have it work either since they both scroll vertically.