xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.xxx.MainActivity">
<WebView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/webView" />
</RelativeLayout>
java
WebView mWebView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mWebView = (WebView) findViewById(R.id.webView);
mWebView.loadUrl("http://xprogrammer.tistory.com/");
mWebView.setWebViewClient(new MyWebViewClient());
}
private class MyWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url){
view.loadUrl(url);
return true;
}
}
manifest
<uses-permission android:name="android.permission.INTERNET" />
'Mobile > Android' 카테고리의 다른 글
Install Android Studio (0) | 2020.06.24 |
---|---|
Code | Move Statement Up/Down (0) | 2018.08.09 |
애드몹 테스트광고는 잘 표시되는데 실제광고는 표시안될 경우 해결방법 (0) | 2018.04.12 |
gradle project sync failed 해결방법 (0) | 2018.04.06 |
Android hosts 파일 편집하기 (0) | 2017.07.13 |