Android執行個體-利用WebBrowser實現瀏覽器(XE8+小米2)

來源:互聯網
上載者:User

標籤:

 

結果:

1.網路好的情況下,開啟很快,很流暢。

2.地址欄真心不好使,如果真要做應用,這塊必須自己最佳化一下。

 

執行個體代碼:

 1 unit Unit1; 2  3 interface 4  5 uses 6   System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, 7   FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls, 8   FMX.Edit, FMX.Controls.Presentation, FMX.WebBrowser; 9 10 type11   TForm1 = class(TForm)12     WebBrowser1: TWebBrowser;13     ToolBar1: TToolBar;14     Edit1: TEdit;15     Button1: TButton;16     Button2: TButton;17     Button3: TButton;18     StatusBar1: TStatusBar;19     procedure Button1Click(Sender: TObject);20     procedure Edit1KeyDown(Sender: TObject; var Key: Word; var KeyChar: Char;21       Shift: TShiftState);22     procedure Button2Click(Sender: TObject);23     procedure Button3Click(Sender: TObject);24   private25     { Private declarations }26   public27     { Public declarations }28   end;29 30 var31   Form1: TForm1;32 33 implementation34 35 {$R *.fmx}36 {$R *.NmXhdpiPh.fmx ANDROID}37 38 //開啟網頁39 procedure TForm1.Button1Click(Sender: TObject);40 begin41   WebBrowser1.URL := Edit1.Text;42 end;43 44 //返回45 procedure TForm1.Button2Click(Sender: TObject);46 begin47   WebBrowser1.GoBack;48 end;49 50 //前進51 procedure TForm1.Button3Click(Sender: TObject);52 begin53   WebBrowser1.GoForward;54 end;55 56 procedure TForm1.Edit1KeyDown(Sender: TObject; var Key: Word; var KeyChar: Char;57   Shift: TShiftState);58 begin59   if Key = vkReturn then60   begin61     //當按下按鈕時,隱藏輸入鍵盤並把焦點移動到 btnGO 上。62     WebBrowser1.URL := edit1.Text;63     Button1.SetFocus;64   end;65 end;66 67 end.

 

Android執行個體-利用WebBrowser實現瀏覽器(XE8+小米2)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.