1

I am trying to embedded a webview in a framelayout. my launch.xml is as shown below.

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <WebView android:id="@+id/webview" android:layout_width="fill_parent" android:layout_height="fill_parent"/> </FrameLayout> 

I have implemented the WebChromeClient and WidgetViewClient. I have implemented the onTouchEvent and passing the touch events to the WebView.

The problem i am facing is am not able to scroll inside the webview. For example, the content is some 5 lines then am able to see only 3 lines and not able to scroll.

The touch events go to Webview, first action_down and then action_move, am not able to get what wrong am doing??

I have this code also

mWebView.setHorizontalScrollBarEnabled(true); mWebView.setVerticalScrollBarEnabled(true); 

Is there anything else i have to set??

I have checked by replacing the FrameLayout with Scr Thanks in advance..

3 Answers 3

2

It seems there is an issue with scrolling webpages from file:///. The only solution I came up with was to use an innerscrolling in the local Webpages. For that I used a modified script as downloadable at http://cubiq.org/iscroll-4 . The only modification I did was to set in the css the height and line-height of the header and footer to 0px and in the header top and bottom to 0px too. And it works. Maybe it will help you too.

@mdelolmo: Please stop posting any answers like that, it doesn't help to pick out things that have nothing to do with the issue itself. It makes no difference if a Layout is defined or not! And the same Problem he describes occurs when you use the exact code of the webview tutorial!

Sign up to request clarification or add additional context in comments.

Comments

1

First of all, if you just need one child element (the WebView), why do you need the FrameLayout parent tag?

And second, you don't need to handle, any touch events, it handles the scroll automatically and by default. Have you had a look to this WebView tutorial?

Is there any specific reason why you can't do it like they say? If so, what it is? Are you trying to map any other touch events?

2 Comments

Hi,, I have checked the webview tutorial. I removed the FrameLayout but that didnt help in anyway.. I have done exactly same as in the tutorial still it doesnt work.. mWebView.loadUrl (url) ; in this if i give the url as some "google.com" it works just fine, but when the url is "file://mnt/sdcard/abc.html"(which i get unzipping some package) it doesnt work. this issue has screwed me for last 10 days. if i save some page saved from browser and then try to load it as above it works again..
I think you're missing a slash when referencing the html: file:// and your path /mnt/sdcard/abc.html . Would it work?
-1

let the scroll there and make the contents of the webview as wrap_content Like if it works

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.