example:
package com.AndroidWebView;
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;
public class AndroidWebViewActivity extends Activity {
WebView webView;
final String DEFAULT_URL = "http://android-coding.blogspot.com/?m=1";
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
webView = (WebView)findViewById(R.id.webview);
webView.loadUrl(DEFAULT_URL);
}
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
<WebView
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
</LinearLayout>
next:
- More on WebView, override url loading
No comments:
Post a Comment