当子视图的内容发生更改时,滚动视图不会调整大小

TS.*_*.xy 12 android scrollview webview

我有一个WebView里面的ScrollView.

WebView当显示不同的html页面时,dyanamically 的内容会发生变化.

我有以下问题:

例如,我有A.html,和B.html.内容B.html大于A.html,因此页面更长.

WebView负载B.html,了滚动延伸其大小,以使自身滚动的B.html,那么如果我回去A.html,滚动型不调整自身.(滚动区域超出内容A.html)

替代文字

我想要的是动态更改滚动视图的滚动区域以适应webview的内容.

Eby*_*Eby 5

尝试android:fillViewport在滚动视图中使用.. !!

<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" >
Run Code Online (Sandbox Code Playgroud)


Kon*_*rov -3

将 WebView 放置在 ScrollView 中并不是一个好主意。WebView 足够智能,可以自行显示滚动条。

  • 如果我们在 WebView 上方也有想要滚动的内容怎么办?有没有办法让 ScrollView 重新评估? (7认同)
  • 我想知道为什么这个答案被接受,问题是“如何?” 而不是“这是个好主意吗?” (3认同)