Sagar Masuti
Sagar Masuti

Reputation: 11

Webview + scrolling issue + android

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..

Upvotes: 1

Views: 7268

Answers (3)

Muhammad Shahnawaz
Muhammad Shahnawaz

Reputation: 129

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

Upvotes: -1

Aqm
Aqm

Reputation: 21

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!

Upvotes: 2

mdelolmo
mdelolmo

Reputation: 6447

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?

Upvotes: 1

Related Questions