我有带有以下代码的程序的主类
public class HTMLViewActivity extends Activity {
private WebView web;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
DisplayMetrics metrics = this.getResources().getDisplayMetrics();
int width = metrics.widthPixels;
int height = metrics.heightPixels;
web = (WebView) findViewById(R.id.webView1);
web.setLayoutParams(new LinearLayout.LayoutParams( width , height));
web.getSettings().setJavaScriptEnabled(true);
web.getSettings().setRenderPriority(RenderPriority.HIGH);
web.getSettings().setDomStorageEnabled(true);
web.getSettings().setDatabaseEnabled(true);
web.getSettings().setDatabasePath("/data/data/" + "web" + "/databases/");
web.getSettings().setAppCacheEnabled(true);
web.setSoundEffectsEnabled(true);
web.setKeepScreenOn(true);
web.clearView();
web.measure(10, 10);
web.loadUrl("http://www.fullscreenmario.com/stable/mario.html");
}
}
当我在这个 webview 中加载页面时它非常大,我无法改变它。在移动 Chrome 中,它具有正常大小