Project Name : HttpWebView
Activity : First.java
API version 10
웹뷰는 웹브라우저를 통해 웹사이트의 문서를 보여주는 역할입니다.
구글 메인페이지 소스가 가장 간단하기 때문에 구글로 연결하도록 하겠습니다.
아주 간단한 작업이니 오래 걸리지 않으실 겁니다^^
이 글이 도움이 되신다면 추천 한 방 부탁드려요~
양질의 정보로 보답하겠습니다
main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
>
<WebView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textSize="26dp"
android:gravity="center"
android:textColor="#ff0000"
android:background="#00ff00"
android:text="webview"
android:id="@+id/webview" />
</LinearLayout>
HttpWebViewMainfest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.httpwebview"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="10" />
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.httpwebview.First"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
First.java
package com.example.httpwebview
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.webkit.WebView;
public class First extends Activity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
WebView mWebView = (WebView)findViewById(R.id.webview);
//자바 스크립트도 보여주겠다.
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.loadUrl("http://www.google.com");
}//end
}//main END
strings.xml 은 굳이 따로 수정할 내용은 없습니다~
실행화면은 아래와 같습니다.
'IT > Android' 카테고리의 다른 글
안드로이드 SQLite DB 활용한 고객등록과 조회 3-2 (0) | 2013.07.19 |
---|---|
안드로이드 SQLite DB 활용한 고객등록과 조회 3-1 (0) | 2013.07.18 |
Android 고객등록/정보전달 02 (0) | 2013.07.15 |
Android(안드로이드) 웹서버 (0) | 2013.07.15 |
Android 고객등록/정보전달 01 (0) | 2013.07.12 |