import android.app.Activity; import android.os.Bundle; import android.webkit.WebView; import android.webkit.WebViewClient;
/** * Created by oo on 2017-09-22. */
public class SubWebview extends Activity { WebView mWeb; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main2);
mWeb = (WebView) findViewById(R.id.webView1); mWeb.getSettings().setJavaScriptEnabled(true); mWeb.loadUrl("http://m.naver.com"); mWeb.setWebViewClient(new WebClient()); }
private class WebClient extends WebViewClient { public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } }
}
<uses-permission android:name="android.permission.INTERNET" />
themes.xml 에 추가
<item name="android:windowFullscreen">true</item> <item name="windowNoTitle">true</item>
I/chromium: [INFO:CONSOLE(241)] "Mixed Content: The page at
https 가 아닌 http 들어가 있는 경우아래 코드 추가
webView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
|