如何显示网页在我的应用程序?我的、应用程序、网页

由网友(人肥回忆瘦.)分享简介:我需要从服务器端简单的网页发送(含图片)一些如何(MHT,或压缩网页文件夹),并显示在我的Andr​​oid应用程序的UI没有浏览器控件,能有人指点我如何进行的在Android设备?I need to send from server side simple web pages (with images) some...

我需要从服务器端简单的网页发送(含图片)一些如何(MHT,或压缩网页文件夹),并显示在我的Andr​​oid应用程序的UI没有浏览器控件,能有人指点我如何进行的在Android设备?

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, can someone advice my how to proceed with that on Android device?

感谢

推荐答案

要显示一个网页,在你的应用程序,有两种方法可以做到这一点,采用Android的默认浏览器,或使用web视图,这第二个,你可以这样做:

to show an webpage in your app , there is two ways to do it , use the default Browser of Android , or use an WebView , for this 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");

编辑:布局XML: 在布局XML中,定义了一个web视图是这样的:

EDIT : 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" />
阅读全文

相关推荐

最新文章