欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Android使用WebView.loadUri()打開網(wǎng)頁的方法

 更新時間:2016年01月29日 10:01:35   作者:馬到成功  
這篇文章主要介紹了Android使用WebView.loadUri()打開網(wǎng)頁的方法,結(jié)合實例形式分析了Android中WebView控件的loadUri()打開網(wǎng)頁的使用技巧,需要的朋友可以參考下

本文實例講述了Android使用WebView.loadUri()打開網(wǎng)頁的方法。分享給大家供大家參考,具體如下:

程序如下所示:

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.WebView;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.Toast;
public class A07Activity extends Activity {
 private EditText et;//用來輸入網(wǎng)址
 private ImageButton ib;//用來觸發(fā)打開網(wǎng)頁的事件
 private WebView wv;
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    et=(EditText)findViewById(R.id.et);
    ib=(ImageButton)findViewById(R.id.ib);
    wv=(WebView)findViewById(R.id.wv);
    ib.setImageResource(R.drawable.start);//加載ImageButton的按鈕圖片
    ib.setOnClickListener(new OnClickListener(){
  @Override
  public void onClick(View v) {
  // TODO Auto-generated method stub
  String s=et.getText().toString();//獲得網(wǎng)址
  wv.loadUrl(s);//把網(wǎng)址傳入
  Toast.makeText(A07Activity.this, "百度一下,你就知道", Toast.LENGTH_LONG).show();
  }
    });
  }
}

更多關(guān)于Android控件相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《Android控件用法總結(jié)

希望本文所述對大家C#程序設(shè)計有所幫助。

相關(guān)文章

最新評論