Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scroll view doesn't resize when the content of child view changes

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)

alt text

What I want to have, is dynamic change the scroll area of scroll view to fit the webview's content.

like image 767
TS.xy Avatar asked Aug 18 '10 05:08

TS.xy


2 Answers

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" >
like image 112
Eby Avatar answered Nov 17 '22 00:11

Eby


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 );
like image 23
zap Avatar answered Nov 17 '22 00:11

zap