public class SecondActivity extends AppCompatActivity {
private WebView webView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_second);
webView=(WebView)findViewById(R.id.webView) ;
webView.loadUrl("file:///android_asset/index.htm");
webView.requestFocus();//获取焦点
webView.setHorizontalScrollBarEnabled(false);
webView.setVerticalScrollBarEnabled(false);
webView.setVerticalScrollbarOverlay(true);
//添加客户端支持
webView.setWebViewClient(new WebViewClient(){
//点击不会跳转到浏览器外
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;//super.shouldOverrideUrlLoading(view, url);
}
});
WebSettings webSettings = webView.getSettings();
webview导入H5小游戏
最新推荐文章于 2022-01-05 16:32:29 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)