我正在使用选框效果实现Web视图。我有一个字符串,并通过执行以下代码将其作为HTML内容加载。
String test= "this is a test. this is a test. this is a test. this is a test. this is a test. this is a test. this is a test. this is a test. this is a test. this is a test. this is a test. this is a test. this is a test. this is a test. this is a test. this is a test.";
summary = "<html><FONT ><marquee behavior='scroll' direction='left' scrollamount=" + speed + ">"
+ test + "</marquee></FONT></html>";
我在网页视图中加载此内容如下所示。
webviewScroll.loadDataWithBaseURL(null, summary, "text/html", "UTF-8", null);
以下代码使文字显示在页面的中间
webviewScroll.setPictureListener(new WebView.PictureListener(){ int previousHeight;
@Override
public void onNewPicture(WebView w, Picture p) {
int height = w.getContentHeight();
webviewScroll.scrollTo(0, height / 2);
webviewScroll.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
return (event.getAction() == MotionEvent.ACTION_MOVE);
}
});
}
});
问题是,当内容即将完成时,它会缩小并最终消失。问题只发生在内容即将完成且内容很大的情况下。小内容不是这样发生的。
下面我附上了网页视图中缩小内容的截图。
下面的图片显示了内容的选框,而不是在开始时在网页视图中缩小。
有人知道为什么会这样吗?