WebView Scrolling Issues
Hi,
I am experiencing issues with scrolling in a WebView. I currently have a WebView that has HTML content. My WebView width and height is bigger then the device (ipad) screen size so the user will have to scroll along the to see the rest of the content.
The problem I am getting is I that can't seem to scroll freely like in a ScrollView, instead I am only able to scroll either left and right or up and down. I cant seem to scroll in any other direction. I want to be able to scroll freely in any direction like in the ScrollView instead or just up or down and left or right.
Has anyone experienced this problem and if so can you please provide me with a solution. I've search the Internet for days without success!
Many Thanks!
2 Answers
-
Thanks for your answer Rainer but your suggestion didn't work for me.
I managed to find a way around the WebView one-directional scrolling by putting the WebView inside ScollView and setting the 'touchEnabled' on the WebView to 'false' however this then means I can't click on any html buttons etc.
Here is my code:
var tabGroup = Titanium.UI.createTabGroup(); var win1 = Titanium.UI.createWindow({ title:'Tab 1', }); var webview = Ti.UI.createWebView({ url: "http://www.appcelerator.com", touchEnabled: false, }); var scrollView = Ti.UI.createScrollView({ contentWidth:'auto', contentHeight:'auto', showVerticalScrollIndicator:true, showHorizontalScrollIndicator:true }); var view = Ti.UI.createView({ width:'1000', height:'2000', }); view.add(webview); scrollView.add(view); win1.add(scrollView); var tab1 = Titanium.UI.createTab({ icon:'KS_nav_views.png', title:'Tab 1', window:win1 }); tabGroup.addTab(tab1); tabGroup.open();
-
If you pack webviews in a scrollable view, then the width of webview must be equal or smaller then width of scrollable view.