如何显示网页在我的应用程序? [英] How to show web page in my app?

查看:96
本文介绍了如何显示网页在我的应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从服务器端简单的网页发送(含图片)一些如何(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" />

这篇关于如何显示网页在我的应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆