Web Apps总揽(Web Apps Overview)

 

Figure 1. You can make your web content available to users in two ways: in a traditional web browser and in an Android application, by including a WebView in the layout.

图形1 .  你可以通过两种方式将你的Web内容提供给用户:一种是放在传统的Web浏览器中。另外一种使用布局中WebView组件将其放在android应用中。

     
         There are essentially two ways to deliver an application on Android: as a client-side application (developed using the Android SDK and installed on user devices as an .apk) or as a web application (developed using web standards and accessed through a web browser—there's nothing to install on user devices).

      对于Web应用,android应用程序实质上提供了两种方法:1、使用一个客户端应用程序(使用android SDK 进行开发,以.apk的形式安装在用户的设备上) 2、使用一个网络应用程序(使用Web标准进行开发,然后通过Web浏览器进行访问——不需要在用户的设备上插入任何东西)。

      The approach you choose for your application could depend on several factors, but Android makes the decision to develop a web application easier by providing:

      Support for viewport properties that allow you to properly size your web application based on the screen size   

      CSS and JavaScript features that allow you to provide different styles and images based on the screen's pixel density (screen resolution)

         你对你所选择的应用程序进行处理,就必须依赖于一些因素,android为了让开发一个Web应用变得更加容易,提供了以下一些支持:
         提供视图属性,你可以根据屏幕的大小使用视图属性来调整你Web应用的大小。

     支持CSS和JavaScript特性,基于屏幕的像素密度(屏幕分辨率),你可以提供不同样式和图片。    

    

 

 

       Thus, your decision to develop a web application for Android can exclude consideration for screen support, because it's already easy to make your web pages look good on all types of screens powered by Android.

       因此,当你决定开发一个android Web应用的时,不需要考虑对于屏幕大小的支持。因为android已经可以将你的网页很好的显示在各种尺寸的屏幕上。

      Another great feature of Android is that you don't have to build your application purely on the client or purely on the web. You can mix the two together by developing a client-side Android application that embeds some web pages (using a WebView in your Android application layout). Figure 1 visualizes how you can provide access to your web pages from either a web browser or your Android application. However, you shouldn't develop an Android application simply as a means to launch your web site. Rather, the web pages you embed in your Android application should be designed especially for that environment. You can even define an interface between your Android application and your web pages that allows JavaScript in the web pages to call upon APIs in your Android application—providing Android APIs to your web-based application.

      Android的另一个好的特性就是你不需要将你的应用纯粹地建立在客户端或者是纯粹地建立在Web上。你可以混合使用这两种来开发一些需要嵌入许多网页的客户端Android应用(在你的android 应用布局中使用WebView)。图1展示了如何将网页放在网页浏览器或者你的android应用中。然而你不能简单地以开发一个android应用为手段去导入你的网站。相反,你需要为嵌入到你应用中的网页的这个环境做特别设计。你甚至可以定义一个接口在你的android应用和网页之间。你可以使用网页中的JavaScript来请求你的adroid应用中的APIs——基于Web应用的Android APIs。

      Since Android 1.0, WebView has been available for Android applications to embed web content in their layout and bind JavaScript to Android APIs. After Android added support for more screen densities (adding support for high and low-density screens), Android 2.0 added features to the WebKit framework to allow web pages to specify viewport properties and query the screen density in order to modify styles and image assets, as mentioned above. Because these features are a part of Android's WebKit framework, both the Android Browser (the default web browser provided with the platform) and WebView support the same viewport and screen density features.

      

      从 android 1.0 开始,WebView被用到android应用中,将网页嵌入到相应的布局中和绑定JavaScript到android APIs。后来,Android增加支持更多的屏幕分辨率(增加支持高分辨率和低分辨率)。Android 2.0 添加了新的功能。主要是使用WebKit框架来允许网页指定窗口属性和查询屏幕密度来调整修改样式和图片资源,如上所述。

因为这些功能是Android WebKit的框架的一个部分,同样Android浏览器(默认的web浏览器提供了平台)和WebView也支持窗口属性和屏幕密度的功能。

 

原文地址:http://developer.android.com/guide/webapps/overview.html

 

ps:第一篇英文翻译,竟然花了我一小时的时间,继续努力,英文应该是我的下一个瓶颈~~

posted @ 2013-04-28 16:25  奇异果Kiwi  阅读(250)  评论(0编辑  收藏  举报