ホーム > タグ > キャッシュ

キャッシュ

[Android] WebViewで簡易ブラウジング

WebViewを使うことで簡単にブラウザ機能を実装することができます。
 

まずはレイアウトファイル。
こんな感じで記述します。

1<?xml version="1.0" encoding="utf-8"?>
2<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3    android:layout_width="fill_parent"
4    android:layout_height="fill_parent"
5    android:orientation="vertical" >
6 
7    <WebView
8        android:id="@+id/wv_Main"
9        android:layout_width="fill_parent"
10        android:layout_height="fill_parent" />
11</LinearLayout>

 
プログラム側でWebViewクラスの loadUrl() を呼び出すことで対象ページを表示できます。

1pubcli void loadGooglePage()
2{
3    WebView wvMain = (WebView)findViewById(R.id.wv_Main);
4    wvMain.loadUrl("http://google.co.jp");
5}

 
 

Continue reading

Home > Tags > キャッシュ

Search
Feeds
Meta
人気の記事

Return to page top