Android Application
작성자 임베디드코리아
작성일19-04-03 23:25
조회3,999회
댓글0건
웹뷰는 안드로이드 프레임웍에 내장된 웹 브라우져 컴포넌트로 뷰(View)형태
첨부는 간단한 웹브라우저 입니다
AndroidManifest.xml 파일에서
<uses-permission android:name="android.permission.INTERNET" /> 추가
<application> 부분에 android:usesCleartextTraffic="true" 로 설정
------------ activity_main.xml -----
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">
<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/webView" />
</LinearLayout>
-- AndroidManifest.xml 설정 인터넷 퍼미션 추가
<uses-permission android:name="android.permission.INTERNET" />
<application
android:usesCleartextTraffic="true"
---------------------------------------------------------------------------------------------------
MainActivity.java
--------------------------------------------------------------------------------------------------
public class MainActivity extends AppCompatActivity {
private WebView webView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
webView = (WebView)findViewById(R.id.webView);
webView.loadUrl("http://www.embeddedkorea.com");
}
}