游戏邦在:
杂志专栏:
gamerboom.com订阅到鲜果订阅到抓虾google reader订阅到有道订阅到QQ邮箱订阅到帮看

谷歌Fragments API或增强应用程序用户体验

发布时间:2011-03-08 09:05:00 Tags:,,,

谷歌Honeycomb操作系统是专为大屏幕的平板电脑而优化设计的,但现在Android智能手机也有望运行这个新平台了。日前,谷歌通过Android开发者博客表示,“Android兼容包”所包含的Fragments API,支持开发商针对Android 1.6及其以上版本的平台创建应用软件。游戏邦获悉,Fragments是摩托罗拉Xoom平板电脑的重要元素之一,支持移动设备同时展示多个活动窗口,可极大提高应用程序的可用性。

android-fragments

android-fragments

以下是谷歌公布Honeycomb平台性能时对Fragments的描述:

“开发者可以将应用程序的Activities打碎成若干个Fragments子部件,然后将它们用各种方式整合为一体,创造更丰富、更具互动性的体验。例如,一个应用程序可以使用一系列Fragments创建一个真正多格的UI,用户可以分别独立访问每个格子。这些Fragments可以增加,移除,替换,也可以灵活在Activity中体现,它们可在多项Activities中呈现模块化、可重复使用的形态。因为Fragments是模块化的,所以开发者可以有效地针对大小屏幕的设备编写应用程序。”

对Android平板电脑的特定应用程序来说,这种多格用户界面的作用很关键。在Xoom上运行的谷歌Gmail应用就是一个典型的例子。Gmail在该平板电脑上并非显示一个简单的电子邮件列表,而是根据用户的操作情况,显示多个格子,这与苹果iPad上的Mail应用很相似。用户界面会在一个小小的Fragment显示Inboxes和文件夹,但会在一个更大的格子中显示特定文件夹的电子邮件。用户可通过操作将一封电子邮件的文件夹移除出屏幕,所以假如用户要回复一封邮件,只需要关注自己手头的操作即可。Fragments可以来回传输数据,用户可以将一封电子邮件从一个Fragment列表中拖到另一个Fragment文件夹即可对其进行归档,据游戏邦了解苹果iOS目前还不支持这种功能。以下是相关操作的示意图:

gmail

gmail

那么这对智能手机应用程序来说又意味着什么呢?Android开发者可以根据这种互动式的格子,为同样大小的屏幕或者虚拟屏幕设计应用程序。如果是在大屏幕的移动设备上,Fragments的显示效果更佳,因为这样它就可以同时显示两个Fragments,比如Twitter应用就可以显示一个用户tweet列表和其下一个较短的个人资料栏。浏览过程中的数据传输将为这些应用程序带来更微妙的体验。

有了Fragments,开发者就不必过于担心关于智能手机屏幕大小和解决方案的老问题了,因为现在这种UI不同部分的大小和解决方案都各自独立出来了。据谷歌所称,这些Fragments将支持开发者根据屏幕大小创建不同的用户体验,“只要屏幕够大,他们就有可能在同一个活动中包含多个Fragments,如果屏幕不够大,就可以使用不同的Fragments执行独立活动。”屏幕大小的问题,为应用程序的开发提供了更多弹性。

人们对Android平台的一大怨言是它的用户界面不如苹果iOS甚至微软WP7平台那样流畅。虽然如此,但游戏邦还是认为,谷歌推出新工具Fragments API之后,应该会有不少Android智能手机及小型平板电脑的第三方程序员和开发者采用这种UI优化工具。(本文为游戏邦/gamerboom.com编译,转载请注明来源:游戏邦)

Why Android Smartphone Apps Are About to Improve

Google’s Honeycomb operating system is specifically optimized for large-screened tablets, but the first bits of the new platform are starting to now filter down into Android smartphones. The Android Developer Blog notes the release of an “Android Compatibility Package” that includes a new Fragments API for developers building software for Android 1.6 and up. Fragments are a key element for Honeycomb tablets such as Motorola’s Xoom, as they allow for multiple windows of activity on the device display, which can greatly increase the usability of an app.

Here’s how Google described these fragments when it announced the Honeycomb platform capabilities:

“[D]evelopers can break the Activities of their applications into subcomponents called Fragments, then combine them in a variety of ways to create a richer, more interactive experience. For example, an application can use a set of Fragments to create a true multipane UI, with the user being able to interact with each pane independently. Fragments can be added, removed, replaced, and animated inside an Activity dynamically, and they are modular and reusable across multiple Activities. Because they are modular, Fragments also offer an efficient way for developers to write applications that can run properly on both larger screen as well as smaller screen devices.”

The multi-pane user interface is key for certain applications on an Android tablet. Google’s Gmail app on the Xoom is a perfect example. Instead of a single screen showing a simple listing of emails, the Gmail app shows multiple panes that vary based on user interaction, much like the Mail app on Apple’s iPad. The main view shows Inboxes and folders in a small fragment, while a larger pane displays a listing of the emails in a specific folder. Taking action on an email moves the folder fragments off-screen so the user’s full focus is on the action of the action at hand, which could be a mail reply, for example. And fragments can pass data back and forth. An email can be dragged from a list fragment to the folder fragment for filing, something not yet supported on iOS. Here’s a series of three images to demonstrate this in action:

So what does that mean for smartphone applications? Android developers can design applications with interactive panes, either on the same screen or by using virtual screens where the user swipes from one pane to another. Fragments will work best for large-screen devices, where it visually makes sense to use two fragments together, like in a Twitter app that could show a user’s tweet list and a short profile below that. The passing of data between views will reduce the number of screen taps and bring a more refined experience to such apps.

The use of fragments should allow developers to worry less about smartphone screen sizes and resolutions, something that’s been problematic in the past, because these UI parts are size and resolution independent. Google says these fragments will allow developers to adapt the user experience to different screen sizes, saying developers “might include multiple fragments in an activity only when the screen size is sufficiently large, and, when it is not, launch separate activities that use different fragments.” The screen size issue gains a programmatic solution with more flexibility for devs.

One of the common complaints of Android is how the user interface just isn’t fluid or polished as you might find on a device running Apple’s iOS or even Microsoft’s new Windows Phone 7 handsets. And even though I use Android as my primary mobile platform, I admit there’s validity to that observation. With the new Fragments API, however, I think Google is enabling developers to make a change for the better. Now that they have another UI improvement tool at their disposal, I’m looking forward to seeing just how third-party programmers will take advantage of it on Android smartphones and small tablets.(source:gigaom)


上一篇:

下一篇: