开发者

How to show web page in my app?

I need to send from server side simple web pages (with images) some how (mht, or zipped web page folders) and show it on UI of my Android application without browser control, c开发者_开发问答an someone advice my how to proceed with that on Android device?


To show a web page in your app, there are two ways to do it: use the default Browser of Android, or use a WebView. For the second one, you can do this:

WebView webView = (WebView)findViewById(R.id.webView);
//you can load an html code 
webView.loadData("yourCode Html to load on the webView " , "text/html" , "utf-8");
// you can load an URL 
webView.loadUrl("http://www.stackoverflow.com");

layout XML :

In your layout Xml, define an WebView like this:

<WebView android:id="@+id/webView"
       android:layout_width="fill_parent"
       android:layout_height="fill_parent" />


You can use the WebView which is an HTML rendering engine that can be dropped into your application just like any other view. It isnt a full browser though, so you control it from your own application logic.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜