I have a WebView
inside the ScrollView
.
The content of WebView
dyanamically changes when it displays different html page.
I have the following issue:
For example I have A.html
, and B.html
. The content of B.html
is larger than A.html
, so the page is longer.
When WebView
load B.html
, the ScrollView stretches its size to enable itself scroll for B.html, then if I go back to A.html
, ScrollView doesn't resize itself. (The scroll area is exceed the content of A.html
)
What I want to have, is dynamic change the scroll area of scroll view to fit the webview's content.
That's not good idea to place WebView inside of ScrollView. WebView is smart enough to show scrollbars by itself.
Try using android:fillViewport
in scroll view..!!
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scroller"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true" >
After Orientation screen will resize, it works but bad in performance, not a very good solution
setRequestedOrientation( ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE );
setRequestedOrientation( ActivityInfo.SCREEN_ORIENTATION_SENSOR );
Don't put a WebView
inside of a ScrollView
.