【发布时间】:2011-05-23 13:32:41
【问题描述】:
这应该是非常基本的,我只是不知道怎么做。我有一个 webView 显示页面太长而无法一次显示。现在,它显示滚动条,但并没有真正滚动。它只是有点摆动,足以让您知道它是一个活动的滚动条。
希望在 xml 布局中,我希望尽可能让页面滚动以显示整个页面。
我的 xml 布局文件:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<WebView
android:id="@+id/news_view"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
onCreate 调用:
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.news);
WebView webView = (WebView) findViewById(R.id.news_view);
webView.setVerticalScrollBarEnabled(true);
webView.loadUrl("http://www.example.com/index.html");
}
【问题讨论】:
-
“有点移动”是什么意思?请更清楚地说明什么不能正常工作。
-
基本上,它会摆动一点,让您知道它是一个活动滚动条,但滚动长度是可见视图的长度。
-
我试过了,看起来页面没有足够的信息让你注意到滚动。尝试加载更多内容的页面,例如 www.thinkgeek.com :)
-
您使用的初始比例是多少?
-
@Donal:没有做任何关于缩放的事情,所以我想是默认值。