﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>IT博客-linux</title><link>http://www.cnitblog.com/seedshopezhong/</link><description>driver</description><language>zh-cn</language><lastBuildDate>Fri, 01 May 2026 09:14:20 GMT</lastBuildDate><pubDate>Fri, 01 May 2026 09:14:20 GMT</pubDate><ttl>60</ttl><item><title> Android开发指南-框架主题-安全和许可</title><link>http://www.cnitblog.com/seedshopezhong/archive/2010/04/13/65260.html</link><dc:creator>seedshopezhong</dc:creator><author>seedshopezhong</author><pubDate>Tue, 13 Apr 2010 15:13:00 GMT</pubDate><guid>http://www.cnitblog.com/seedshopezhong/archive/2010/04/13/65260.html</guid><wfw:comment>http://www.cnitblog.com/seedshopezhong/comments/65260.html</wfw:comment><comments>http://www.cnitblog.com/seedshopezhong/archive/2010/04/13/65260.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/seedshopezhong/comments/commentRss/65260.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/seedshopezhong/services/trackbacks/65260.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: http://blog.csdn.net/iefreer/archive/2009/09/10/4537371.aspx安全和许可Security and PermissionsAndroid是一个多进程系统，每个应用程序（以及系统的部分）运行在它自己的进程里。大多数程序和系统之间的安全性通过基础的Linux机制在进程级别进行支持，如分配给应用程序的用户和群组IDs。更多细化的安全特性通过...&nbsp;&nbsp;<a href='http://www.cnitblog.com/seedshopezhong/archive/2010/04/13/65260.html'>阅读全文</a><img src ="http://www.cnitblog.com/seedshopezhong/aggbug/65260.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/seedshopezhong/" target="_blank">seedshopezhong</a> 2010-04-13 23:13 <a href="http://www.cnitblog.com/seedshopezhong/archive/2010/04/13/65260.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Android开发指南-框架主题-内容提供器</title><link>http://www.cnitblog.com/seedshopezhong/archive/2010/04/12/65239.html</link><dc:creator>seedshopezhong</dc:creator><author>seedshopezhong</author><pubDate>Mon, 12 Apr 2010 15:55:00 GMT</pubDate><guid>http://www.cnitblog.com/seedshopezhong/archive/2010/04/12/65239.html</guid><wfw:comment>http://www.cnitblog.com/seedshopezhong/comments/65239.html</wfw:comment><comments>http://www.cnitblog.com/seedshopezhong/archive/2010/04/12/65239.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/seedshopezhong/comments/commentRss/65239.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/seedshopezhong/services/trackbacks/65239.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 内容提供器Content Providers内容提供器用来存放和获取数据并使这些数据可以被所有的应用程序访问。它们是应用程序之间共享数据的唯一方法；不存在所有Android软件包都能访问的公共储存区域。Android为常见数据类型（音频，视频，图像，个人联系人信息，等等）装载了很多内容提供器。你可以看到在android.provider包里列举了一些。你还能查询这些提供器包含了什么数据（尽管，对某...&nbsp;&nbsp;<a href='http://www.cnitblog.com/seedshopezhong/archive/2010/04/12/65239.html'>阅读全文</a><img src ="http://www.cnitblog.com/seedshopezhong/aggbug/65239.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/seedshopezhong/" target="_blank">seedshopezhong</a> 2010-04-12 23:55 <a href="http://www.cnitblog.com/seedshopezhong/archive/2010/04/12/65239.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Android开发指南-框架主题-数据存储</title><link>http://www.cnitblog.com/seedshopezhong/archive/2010/04/12/65238.html</link><dc:creator>seedshopezhong</dc:creator><author>seedshopezhong</author><pubDate>Mon, 12 Apr 2010 15:53:00 GMT</pubDate><guid>http://www.cnitblog.com/seedshopezhong/archive/2010/04/12/65238.html</guid><wfw:comment>http://www.cnitblog.com/seedshopezhong/comments/65238.html</wfw:comment><comments>http://www.cnitblog.com/seedshopezhong/archive/2010/04/12/65238.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/seedshopezhong/comments/commentRss/65238.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/seedshopezhong/services/trackbacks/65238.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 数据存储Data Storage概览Storage quickview&#178;&nbsp;&nbsp;系统偏好：快速，轻量级存储&#178;&nbsp;&nbsp;文件：存储到设备内部或可移动闪存&#178;&nbsp;&nbsp;数据库：任意的结构化存储&#178;&nbsp;&nbsp;支持基于网络的存储一个典型的桌面操作系统提供了一个通用文件系统使得任何应用程序能够使用它来存储文件，这些...&nbsp;&nbsp;<a href='http://www.cnitblog.com/seedshopezhong/archive/2010/04/12/65238.html'>阅读全文</a><img src ="http://www.cnitblog.com/seedshopezhong/aggbug/65238.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/seedshopezhong/" target="_blank">seedshopezhong</a> 2010-04-12 23:53 <a href="http://www.cnitblog.com/seedshopezhong/archive/2010/04/12/65238.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Android开发指南-框架主题-意图和意图过滤器</title><link>http://www.cnitblog.com/seedshopezhong/archive/2010/04/12/65236.html</link><dc:creator>seedshopezhong</dc:creator><author>seedshopezhong</author><pubDate>Mon, 12 Apr 2010 15:34:00 GMT</pubDate><guid>http://www.cnitblog.com/seedshopezhong/archive/2010/04/12/65236.html</guid><wfw:comment>http://www.cnitblog.com/seedshopezhong/comments/65236.html</wfw:comment><comments>http://www.cnitblog.com/seedshopezhong/archive/2010/04/12/65236.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/seedshopezhong/comments/commentRss/65236.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/seedshopezhong/services/trackbacks/65236.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 转自:http://blog.csdn.net/iefreer/archive/2009/08/17/4456376.aspx意图和意图过滤器Intents and Intent Filters&nbsp;一个应用程序的三个核心组件-活动，服务和广播接收器是通过消息即意图（Intents）来激活的。Intent消息传送是相同或不同应用中组件运行时晚绑定的一种机制。意图本身，一个意图对象，是一个包含...&nbsp;&nbsp;<a href='http://www.cnitblog.com/seedshopezhong/archive/2010/04/12/65236.html'>阅读全文</a><img src ="http://www.cnitblog.com/seedshopezhong/aggbug/65236.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/seedshopezhong/" target="_blank">seedshopezhong</a> 2010-04-12 23:34 <a href="http://www.cnitblog.com/seedshopezhong/archive/2010/04/12/65236.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Android开发指南-框架主题-资源和资产</title><link>http://www.cnitblog.com/seedshopezhong/archive/2010/04/11/65215.html</link><dc:creator>seedshopezhong</dc:creator><author>seedshopezhong</author><pubDate>Sun, 11 Apr 2010 14:28:00 GMT</pubDate><guid>http://www.cnitblog.com/seedshopezhong/archive/2010/04/11/65215.html</guid><wfw:comment>http://www.cnitblog.com/seedshopezhong/comments/65215.html</wfw:comment><comments>http://www.cnitblog.com/seedshopezhong/archive/2010/04/11/65215.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/seedshopezhong/comments/commentRss/65215.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/seedshopezhong/services/trackbacks/65215.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 转载于:http://blog.csdn.net/iefreer/archive/2009/09/06/4526004.aspxAndroid开发指南-框架主题-资源和资产资源和资产Resources and Assets资源是Android应用程序不可或缺的部分。一般而言，资源是你想包含和引入到应用程序里面的一些外部元素，比如图片、音频、视频、文本字符串、布局、主题等。每个Android应用程序...&nbsp;&nbsp;<a href='http://www.cnitblog.com/seedshopezhong/archive/2010/04/11/65215.html'>阅读全文</a><img src ="http://www.cnitblog.com/seedshopezhong/aggbug/65215.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/seedshopezhong/" target="_blank">seedshopezhong</a> 2010-04-11 22:28 <a href="http://www.cnitblog.com/seedshopezhong/archive/2010/04/11/65215.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Android开发指南-用户界面-绘制视图</title><link>http://www.cnitblog.com/seedshopezhong/archive/2010/04/11/65213.html</link><dc:creator>seedshopezhong</dc:creator><author>seedshopezhong</author><pubDate>Sun, 11 Apr 2010 13:55:00 GMT</pubDate><guid>http://www.cnitblog.com/seedshopezhong/archive/2010/04/11/65213.html</guid><wfw:comment>http://www.cnitblog.com/seedshopezhong/comments/65213.html</wfw:comment><comments>http://www.cnitblog.com/seedshopezhong/archive/2010/04/11/65213.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/seedshopezhong/comments/commentRss/65213.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/seedshopezhong/services/trackbacks/65213.html</trackback:ping><description><![CDATA[

<div>转自:<a href="http://blog.csdn.net/iefreer/archive/2009/09/27/4602532.aspx">http://blog.csdn.net/iefreer/archive/2009/09/27/4602532.aspx</a></div><div><span  style="font-family: verdana, sans-serif; font-size: 14px; line-height: 21px; "><p class="MsoNormal" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 7.5pt; margin-left: 0cm; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(226, 226, 226); text-indent: 0cm; background-position: initial initial; background-repeat: initial initial; "><strong><span lang="EN-US" style="line-height: 34px; font-size: 17pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; ">Android</span></strong><strong><span style="line-height: 34px; font-size: 17pt; color: rgb(51, 51, 51); font-family: 宋体; ">怎么绘画视图</span></strong><strong><span lang="EN-US" style="line-height: 34px; font-size: 17pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; ">How Android Draws Views</span></strong></p><p class="MsoNormal" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 12pt; margin-left: 0cm; text-indent: 0cm; line-height: 15.6pt; "><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">当一个活动接收到焦点时，它将被要求绘制它的布局。</span><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; ">Android</span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">框架将处理这个绘画的过程，但是活动必须提供它的布局层次的根节点。</span></p><p class="MsoNormal" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 12pt; margin-left: 0cm; text-indent: 0cm; line-height: 15.6pt; "><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">绘画从布局的根节点开始。它被要求来测量和绘制布局树。绘画通过遍历布局树并渲染每个和失效区域相交的视图来处理。相应的，每个视图组负责请求绘制它的子视图（通过</span><span lang="EN-US" style="line-height: 24px; font-size: 12pt; color: rgb(0, 112, 0); font-family: 'Courier New'; "><a href="file:///D:/android-sdk-windows-1.5_r2/docs/reference/android/view/View.html#draw(android.graphics.Canvas)" style="text-decoration: none; color: rgb(51, 102, 153); "><span style="line-height: 24px; color: rgb(0, 102, 153); ">draw()</span></a></span><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; ">&nbsp;</span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">方法）而每个视图负责画它自己。因为这个树是顺序遍历的，这意味着先画父节点（也就是在屏幕后面），然后按照树中出现的顺序画其同层次节点。</span></p><p class="MsoNormal" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 3pt; margin-left: 0cm; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(255, 255, 238); text-indent: 0cm; line-height: 15.6pt; background-position: initial initial; background-repeat: initial initial; "><span style="line-height: 18px; font-size: 9pt; color: rgb(51, 51, 51); font-family: 宋体; ">框架将不会画不在失效区域的视图，而且还将会帮你画视图背景。</span></p><p class="MsoNormal" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 3pt; margin-left: 0cm; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(255, 255, 238); text-indent: 0cm; line-height: 15.6pt; background-position: initial initial; background-repeat: initial initial; "><span style="line-height: 18px; font-size: 9pt; color: rgb(51, 51, 51); font-family: 宋体; ">你可以强制一个视图被重画，通过调用</span><span lang="EN-US" style="line-height: 24px; font-size: 12pt; color: rgb(0, 112, 0); font-family: 'Courier New'; "><a href="file:///D:/android-sdk-windows-1.5_r2/docs/reference/android/view/View.html#invalidate()" style="text-decoration: none; color: rgb(51, 102, 153); "><span style="line-height: 24px; color: rgb(0, 102, 153); ">invalidate()</span></a></span><span style="line-height: 18px; font-size: 9pt; color: rgb(51, 51, 51); font-family: 宋体; ">。</span></p><p class="MsoNormal" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 12pt; margin-left: 0cm; text-indent: 0cm; line-height: 15.6pt; "><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">绘画布局共有两步：一个度量过程和一个布局过程。度量过程在</span><span lang="EN-US" style="line-height: 24px; font-size: 12pt; color: rgb(0, 112, 0); font-family: 'Courier New'; "><a href="file:///D:/android-sdk-windows-1.5_r2/docs/reference/android/view/View.html#measure(int, int)" style="text-decoration: none; color: rgb(51, 102, 153); "><span style="line-height: 24px; color: rgb(0, 102, 153); ">measure(int, int)</span></a></span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">里实现且是一个自顶向下的视图树遍历。每个视图在递归时往下推送尺寸规格。在度量过程的最后，每个视图都已经保存了自己的度量。第二个过程发生在</span><span lang="EN-US" style="line-height: 24px; font-size: 12pt; color: rgb(0, 112, 0); font-family: 'Courier New'; "><a href="file:///D:/android-sdk-windows-1.5_r2/docs/reference/android/view/View.html#layout(int, int, int, int)" style="text-decoration: none; color: rgb(51, 102, 153); "><span style="line-height: 24px; color: rgb(0, 102, 153); ">layout(int, int, int, int)</span></a></span><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; ">&nbsp;</span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">中并且也是自顶向下。在这个过程中，每个父节点负责定位它的所有子节点，通过使用在度量过程中计算得到的尺寸。</span></p><p class="MsoNormal" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 12pt; margin-left: 0cm; text-indent: 0cm; line-height: 15.6pt; "><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">当一个视图的</span><span lang="EN-US" style="line-height: 24px; font-size: 12pt; color: rgb(0, 112, 0); font-family: 'Courier New'; ">measure()</span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">方法返回时，它的</span><span lang="EN-US" style="line-height: 24px; font-size: 12pt; color: rgb(0, 112, 0); font-family: 'Courier New'; "><a href="file:///D:/android-sdk-windows-1.5_r2/docs/reference/android/view/View.html#getMeasuredWidth()" style="text-decoration: none; color: rgb(51, 102, 153); "><span style="line-height: 24px; color: rgb(0, 102, 153); ">getMeasuredWidth()</span></a></span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">和</span><span lang="EN-US" style="line-height: 24px; font-size: 12pt; color: rgb(0, 112, 0); font-family: 'Courier New'; "><a href="file:///D:/android-sdk-windows-1.5_r2/docs/reference/android/view/View.html#getMeasuredHeight()" style="text-decoration: none; color: rgb(51, 102, 153); "><span style="line-height: 24px; color: rgb(0, 102, 153); ">getMeasuredHeight()</span></a></span><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; ">&nbsp;</span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">值必须被设置，以及所有这个视图子节点的值。一个视图的度量的宽度和高度值必须符合父视图引入的限制。这确保在度量过程之后，所有父节点接受所有它们的子节点的度量值。一个父视图可能会在其子视图上多次调用</span><span lang="EN-US" style="line-height: 24px; font-size: 12pt; color: rgb(0, 112, 0); font-family: 'Courier New'; ">measure()</span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">方法。比如，父视图可能会通过未指定的尺寸调用</span><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; ">measure</span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">来发现它们的大小，然后使用实际数值再次调用</span><span lang="EN-US" style="line-height: 24px; font-size: 12pt; color: rgb(0, 112, 0); font-family: 'Courier New'; ">measure()</span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">，如果所有子视图未做限制的尺寸总合过大或过小（也即是，如果子视图之间不能对各自占据的空间达成共识的话，父视图将会干预并设置第二个过程的规则）。</span></p><p class="MsoNormal" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 3pt; margin-left: 0cm; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(255, 255, 238); text-indent: 0cm; line-height: 15.6pt; background-position: initial initial; background-repeat: initial initial; "><span style="line-height: 18px; font-size: 9pt; color: rgb(51, 51, 51); font-family: 宋体; ">要开始一个布局，可调用</span><span lang="EN-US" style="line-height: 24px; font-size: 12pt; color: rgb(0, 112, 0); font-family: 'Courier New'; "><a href="file:///D:/android-sdk-windows-1.5_r2/docs/reference/android/view/View.html#requestLayout()" style="text-decoration: none; color: rgb(51, 102, 153); "><span style="line-height: 24px; color: rgb(0, 102, 153); ">requestLayout()</span></a></span><span style="line-height: 18px; font-size: 9pt; color: rgb(51, 51, 51); font-family: 宋体; ">。这个方法通常在视图认为它自己不再适合它当前的边界的情况下被调用。</span></p><p class="MsoNormal" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 12pt; margin-left: 0cm; text-indent: 0cm; line-height: 15.6pt; "><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">度量过程使用两个类来交流尺寸。</span><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; "><a href="file:///D:/android-sdk-windows-1.5_r2/docs/reference/android/view/View.MeasureSpec.html" style="text-decoration: none; color: rgb(51, 102, 153); "><span style="line-height: 19px; color: rgb(0, 102, 153); ">View.MeasureSpec</span></a></span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">类被视图用来告诉它们的父视图它们想如何被度量和定位。基础的</span><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; ">LayoutParams</span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">类仅仅描述了视图想有多大（高和宽）。对于每个维度，它可以指定下面之一：</span></p><p class="MsoNormal" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 32.05pt; text-indent: -17.85pt; line-height: 15.6pt; "><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Symbol; "><span style="line-height: 19px; ">&#183;<span style="line-height: normal; font: normal normal normal 7pt/normal 'Times New Roman'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">一个准确的数值</span></p><p class="MsoNormal" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 32.05pt; text-indent: -17.85pt; line-height: 15.6pt; "><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Symbol; "><span style="line-height: 19px; ">&#183;<span style="line-height: normal; font: normal normal normal 7pt/normal 'Times New Roman'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span><em style="font-style: italic; "><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(0, 112, 0); font-family: Arial, sans-serif; ">FILL_PARENT</span></em><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; ">,&nbsp;</span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">这意味着视图想和父视图一样大（减掉填充</span><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; ">padding</span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">）。</span></p><p class="MsoNormal" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 32.05pt; text-indent: -17.85pt; line-height: 15.6pt; "><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Symbol; "><span style="line-height: 19px; ">&#183;<span style="line-height: normal; font: normal normal normal 7pt/normal 'Times New Roman'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span><em style="font-style: italic; "><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(0, 112, 0); font-family: Arial, sans-serif; ">WRAP_CONTENT</span></em><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; ">,&nbsp;</span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">这意味着视图只想有刚好包装其内容那么大（加上填充）</span></p><p class="MsoNormal" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 12pt; margin-left: 0cm; text-indent: 0cm; line-height: 15.6pt; "><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; ">对于不同的ViewGroup子类，有相应的LayoutParams子类。比如，相对布局RelativeLayout有它自己的LayoutParams子类，这包含了能够让子视图横向和竖向居中显示的能力。</span></p><p class="MsoNormal" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 12pt; margin-left: 0cm; text-indent: 0cm; line-height: 15.6pt; "><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; ">度量规格（MeasureSpecs）被用来沿着树从父到子的下传度量需求。一个MeasureSpecs可以是下面三种模式之一：</span></p><p class="MsoNormal" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 32.05pt; text-indent: -17.85pt; line-height: 15.6pt; "><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Symbol; "><span style="line-height: 19px; ">&#183;<span style="line-height: normal; font: normal normal normal 7pt/normal 'Times New Roman'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span><em style="font-style: italic; "><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(0, 112, 0); font-family: Arial, sans-serif; ">UNSPECIFIED</span></em><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; ">: 这被父视图用来决定其子视图期望的尺寸。比如，一个线性布局可能在它的子视图上调用</span><span lang="EN-US" style="line-height: 24px; font-size: 12pt; color: rgb(0, 112, 0); font-family: 'Courier New'; ">measure()</span><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; ">&nbsp;on its child，通过设置其高度为</span><em style="font-style: italic; "><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(0, 112, 0); font-family: Arial, sans-serif; ">UNSPECIFIED</span></em><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; ">&nbsp;以及一个宽度为</span><em style="font-style: italic; "><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(0, 112, 0); font-family: Arial, sans-serif; ">EXACTLY</span></em><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; ">&nbsp;240，来找出这个子视图在给定240像素宽度的情况下需要显示多高。</span></p><p class="MsoNormal" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 32.05pt; text-indent: -17.85pt; line-height: 15.6pt; "><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Symbol; "><span style="line-height: 19px; ">&#183;<span style="line-height: normal; font: normal normal normal 7pt/normal 'Times New Roman'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span><em style="font-style: italic; "><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(0, 112, 0); font-family: Arial, sans-serif; ">EXACTLY</span></em><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; ">: 这被父视图用来给子视图强加一个准确的尺寸。子视图必须使用这个大小，并确保其所有的后代将适合这个尺寸。</span></p><p class="MsoNormal" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 32.05pt; text-indent: -17.85pt; line-height: 15.6pt; "><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Symbol; "><span style="line-height: 19px; ">&#183;<span style="line-height: normal; font: normal normal normal 7pt/normal 'Times New Roman'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span><em style="font-style: italic; "><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(0, 112, 0); font-family: Arial, sans-serif; ">AT_MOST</span></em><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; ">: 这被父视图用来给子视图强加一个最大尺寸。子视图必须确保它自己以及所有的后代都适合这个尺寸。</span></p></span></div><img src ="http://www.cnitblog.com/seedshopezhong/aggbug/65213.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/seedshopezhong/" target="_blank">seedshopezhong</a> 2010-04-11 21:55 <a href="http://www.cnitblog.com/seedshopezhong/archive/2010/04/11/65213.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Android开发指南-用户界面-通用布局对象</title><link>http://www.cnitblog.com/seedshopezhong/archive/2010/04/11/65212.html</link><dc:creator>seedshopezhong</dc:creator><author>seedshopezhong</author><pubDate>Sun, 11 Apr 2010 13:53:00 GMT</pubDate><guid>http://www.cnitblog.com/seedshopezhong/archive/2010/04/11/65212.html</guid><wfw:comment>http://www.cnitblog.com/seedshopezhong/comments/65212.html</wfw:comment><comments>http://www.cnitblog.com/seedshopezhong/archive/2010/04/11/65212.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/seedshopezhong/comments/commentRss/65212.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/seedshopezhong/services/trackbacks/65212.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 转自:http://blog.csdn.net/iefreer/archive/2009/09/28/4606633.aspx通用布局对象Common Layout Objects本章描述了可用于你的应用程序的一些更为通用的布局对象类型。像所有的布局一样，它们是ViewGroup.的子类。也可以参见Hello Views&nbsp;教程，有更多关于使用Android视图布局的指南。框架布局Fram...&nbsp;&nbsp;<a href='http://www.cnitblog.com/seedshopezhong/archive/2010/04/11/65212.html'>阅读全文</a><img src ="http://www.cnitblog.com/seedshopezhong/aggbug/65212.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/seedshopezhong/" target="_blank">seedshopezhong</a> 2010-04-11 21:53 <a href="http://www.cnitblog.com/seedshopezhong/archive/2010/04/11/65212.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Android开发指南-用户界面-绑定数据</title><link>http://www.cnitblog.com/seedshopezhong/archive/2010/04/11/65211.html</link><dc:creator>seedshopezhong</dc:creator><author>seedshopezhong</author><pubDate>Sun, 11 Apr 2010 13:51:00 GMT</pubDate><guid>http://www.cnitblog.com/seedshopezhong/archive/2010/04/11/65211.html</guid><wfw:comment>http://www.cnitblog.com/seedshopezhong/comments/65211.html</wfw:comment><comments>http://www.cnitblog.com/seedshopezhong/archive/2010/04/11/65211.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/seedshopezhong/comments/commentRss/65211.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/seedshopezhong/services/trackbacks/65211.html</trackback:ping><description><![CDATA[转自：<a href="http://blog.csdn.net/iefreer/archive/2009/09/27/4601808.aspx">http://blog.csdn.net/iefreer/archive/2009/09/27/4601808.aspx</a><div><span  style="font-family: verdana, sans-serif; font-size: 14px; line-height: 21px; "><p class="MsoNormal" align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 7.5pt; margin-left: 0cm; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(226, 226, 226); text-align: left; background-position: initial initial; background-repeat: initial initial; "><strong><span style="line-height: 34px; font-size: 17pt; color: rgb(51, 51, 51); font-family: 宋体; ">用</span></strong><strong><span lang="EN-US" style="line-height: 34px; font-size: 17pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; ">AdapterView</span></strong><strong><span style="line-height: 34px; font-size: 17pt; color: rgb(51, 51, 51); font-family: 宋体; ">绑定数据</span></strong><strong><span lang="EN-US" style="line-height: 34px; font-size: 17pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; ">Binding to Data with AdapterView</span></strong></p><p class="MsoNormal" align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 12pt; margin-left: 0cm; line-height: 15.6pt; text-align: left; "><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; "><a href="file:///C:/android-sdk-windows-1.5_r3/docs/reference/android/widget/AdapterView.html" style="text-decoration: none; color: rgb(51, 102, 153); "><span style="line-height: 19px; "><span style="line-height: 19px; color: rgb(0, 102, 153); ">AdapterView</span></span></a></span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">是</span><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; ">ViewGroup</span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">的子类，其子视图由绑定某类型数据的适配器</span><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; "><a href="file:///C:/android-sdk-windows-1.5_r3/docs/reference/android/widget/Adapter.html" style="text-decoration: none; color: rgb(51, 102, 153); "><span style="line-height: 19px; color: rgb(0, 102, 153); ">Adapter</span></a></span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">决定。</span><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; ">AdapterView</span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">用于当你需要在布局中显示存储数据时（不是字符串或可绘制资源）。</span><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; "></span></p><p class="MsoNormal" align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 12pt; margin-left: 0cm; line-height: 15.6pt; text-align: left; "><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">画廊</span><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; "><a href="file:///C:/android-sdk-windows-1.5_r3/docs/reference/android/widget/Gallery.html" style="text-decoration: none; color: rgb(51, 102, 153); "><span style="line-height: 19px; color: rgb(0, 102, 153); ">Gallery</span></a></span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">，列表视图</span><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; "><a href="file:///C:/android-sdk-windows-1.5_r3/docs/reference/android/widget/ListView.html" style="text-decoration: none; color: rgb(51, 102, 153); "><span style="line-height: 19px; color: rgb(0, 102, 153); ">ListView</span></a></span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">，和</span><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; "><a href="file:///C:/android-sdk-windows-1.5_r3/docs/reference/android/widget/Spinner.html" style="text-decoration: none; color: rgb(51, 102, 153); "><span lang="EN-US" style="line-height: 19px; color: rgb(51, 51, 51); font-family: 宋体; text-decoration: none; "><span lang="EN-US" style="line-height: 19px; ">微调</span></span></a></span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">控件</span><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; "><a href="file:///C:/android-sdk-windows-1.5_r3/docs/reference/android/widget/Spinner.html" style="text-decoration: none; color: rgb(51, 102, 153); "><span style="line-height: 19px; color: rgb(0, 102, 153); ">Spinner</span></a></span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">就是适配器视图</span><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; ">AdapterView</span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">子类</span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">的例子，用来</span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">绑定到特定类型的数据并以一定的方式显示。</span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; "><span lang="EN-US" style="line-height: 19px; "></span></span></p><p class="MsoNormal" align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 12pt; margin-left: 0cm; line-height: 15.6pt; text-align: left; "><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; ">AdapterView</span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">对象有两个主要责任：</span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; "><span lang="EN-US" style="line-height: 19px; "></span></span></p><p class="MsoNormal" align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 32.05pt; text-indent: -17.85pt; line-height: 15.6pt; text-align: left; "><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Symbol; "><span style="line-height: 19px; ">&#183;<span style="line-height: normal; font: normal normal normal 7pt/normal 'Times New Roman'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">用数据填充布局</span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; "><span lang="EN-US" style="line-height: 19px; "></span></span></p><p class="MsoNormal" align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 32.05pt; text-indent: -17.85pt; line-height: 15.6pt; text-align: left; "><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Symbol; "><span style="line-height: 19px; ">&#183;<span style="line-height: normal; font: normal normal normal 7pt/normal 'Times New Roman'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">处理用户的选择</span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; "><span lang="EN-US" style="line-height: 19px; "></span></span></p><div style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; border-left-color: initial; padding-top: 6pt; "><p class="MsoNormal" align="left" style="padding-top: 0cm; padding-right: 0cm; padding-bottom: 0cm; padding-left: 0cm; margin-top: 18pt; margin-right: 0cm; margin-bottom: 12pt; margin-left: 0cm; text-align: left; "><strong><span style="line-height: 28px; font-size: 14.5pt; color: rgb(17, 17, 17); font-family: 宋体; ">用数据填充布局</span></strong><strong><span lang="EN-US" style="line-height: 28px; font-size: 14.5pt; color: rgb(17, 17, 17); font-family: Arial, sans-serif; ">Filling the Layout with Data</span></strong><strong><span lang="EN-US" style="line-height: 28px; font-size: 14.5pt; color: rgb(17, 17, 17); font-family: Arial, sans-serif; "></span></strong></p></div><p class="MsoNormal" align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 12pt; margin-left: 0cm; line-height: 15.6pt; text-align: left; "><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">通常是通过绑定</span><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; ">AdapterView</span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">类到一个适配器</span><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; "><a href="file:///C:/android-sdk-windows-1.5_r3/docs/reference/android/widget/Adapter.html" style="text-decoration: none; color: rgb(51, 102, 153); "><span style="line-height: 19px; color: rgb(0, 102, 153); ">Adapter</span></a></span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">来</span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">插入数据到布局中，这从外部获取数据（可能是代码中所提供的一个列表数据，或者是设备数据库中的查询结果）。</span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; "><span lang="EN-US" style="line-height: 19px; "></span></span></p><p class="MsoNormal" align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 12pt; margin-left: 0cm; line-height: 15.6pt; text-align: left; "><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">下面的代码示例执行以下操作：</span><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; "></span></p><p class="MsoNormal" align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 32.05pt; text-indent: -17.85pt; line-height: 15.6pt; text-align: left; "><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; "><span style="line-height: 19px; ">1.<span style="line-height: normal; font: normal normal normal 7pt/normal 'Times New Roman'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">用现有的一个视图创建一个微调控件</span><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; "><a href="file:///C:/android-sdk-windows-1.5_r3/docs/reference/android/widget/Spinner.html" style="text-decoration: none; color: rgb(51, 102, 153); "><span style="line-height: 19px; color: rgb(0, 102, 153); ">Spinner</span></a></span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">并将其绑定到一个新的</span><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; ">ArrayAdapter</span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">，该适配器从本地资源中读取颜色数组。</span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; "><span lang="EN-US" style="line-height: 19px; "></span></span></p><p class="MsoNormal" align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 32.05pt; text-indent: -17.85pt; line-height: 15.6pt; text-align: left; "><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; "><span style="line-height: 19px; ">2.<span style="line-height: normal; font: normal normal normal 7pt/normal 'Times New Roman'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">从一个视图创建另外的微调对象，并将其绑定到一个新的</span><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; ">SimpleCursorAdapter</span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">，将从设备联系人中读取人名（见</span><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; "><a href="file:///C:/android-sdk-windows-1.5_r3/docs/reference/android/provider/Contacts.People.html" style="text-decoration: none; color: rgb(51, 102, 153); "><span style="line-height: 19px; "><span style="line-height: 19px; color: rgb(0, 102, 153); ">Contacts.People</span></span></a></span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">）。</span><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; "></span></p><div style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(250, 250, 250); border-left-color: rgb(204, 204, 204); padding-top: 8pt; padding-right: 8pt; padding-bottom: 8pt; padding-left: 8pt; "><pre style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(250, 250, 250); margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; background-position: initial initial; background-repeat: initial initial; "><span lang="EN-US" style="font-size: 10.5pt; "><span style="color: rgb(0, 112, 0); "><span style="font-family: 'Courier New'; ">// Get a Spinner and bind it to an ArrayAdapter that </span></span></span></pre><pre style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(250, 250, 250); margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; background-position: initial initial; background-repeat: initial initial; "><span lang="EN-US" style="font-size: 10.5pt; "><span style="color: rgb(0, 112, 0); "><span style="font-family: 'Courier New'; ">// references a String array.</span></span></span></pre><pre style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(250, 250, 250); margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; background-position: initial initial; background-repeat: initial initial; "><span lang="EN-US" style="font-size: 10.5pt; "><span style="color: rgb(0, 112, 0); "><span style="font-family: 'Courier New'; ">Spinner s1 = (Spinner) findViewById(R.id.spinner1);</span></span></span></pre><pre style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(250, 250, 250); margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; background-position: initial initial; background-repeat: initial initial; "><span lang="EN-US" style="font-size: 10.5pt; "><span style="color: rgb(0, 112, 0); "><span style="font-family: 'Courier New'; ">ArrayAdapter adapter = ArrayAdapter.createFromResource(</span></span></span></pre><pre style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(250, 250, 250); margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; background-position: initial initial; background-repeat: initial initial; "><span lang="EN-US" style="font-size: 10.5pt; "><span style="color: rgb(0, 112, 0); "><span style="font-family: 'Courier New'; "><span>&nbsp;&nbsp;&nbsp; </span>this, R.array.colors, android.R.layout.simple_spinner_item);</span></span></span></pre><pre style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(250, 250, 250); margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; background-position: initial initial; background-repeat: initial initial; "><span lang="EN-US" style="font-size: 10.5pt; "><span style="color: rgb(0, 112, 0); "><span style="font-family: 'Courier New'; ">adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);</span></span></span></pre><pre style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(250, 250, 250); margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; background-position: initial initial; background-repeat: initial initial; "><span lang="EN-US" style="font-size: 10.5pt; "><span style="color: rgb(0, 112, 0); "><span style="font-family: 'Courier New'; ">s1.setAdapter(adapter);</span></span></span></pre><pre style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(250, 250, 250); margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; background-position: initial initial; background-repeat: initial initial; "><span lang="EN-US" style="font-size: 10.5pt; "><span style="color: rgb(0, 112, 0); font-family: 'Courier New'; ">&nbsp;</span></span></pre><pre style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(250, 250, 250); margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; background-position: initial initial; background-repeat: initial initial; "><span lang="EN-US" style="font-size: 10.5pt; "><span style="color: rgb(0, 112, 0); "><span style="font-family: 'Courier New'; ">// Load a Spinner and bind it to a data query.</span></span></span></pre><pre style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(250, 250, 250); margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; background-position: initial initial; background-repeat: initial initial; "><span lang="EN-US" style="font-size: 10.5pt; "><span style="color: rgb(0, 112, 0); "><span style="font-family: 'Courier New'; ">private static String[] PROJECTION = new String[] {</span></span></span></pre><pre style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(250, 250, 250); margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; background-position: initial initial; background-repeat: initial initial; "><span lang="EN-US" style="font-size: 10.5pt; "><span style="color: rgb(0, 112, 0); "><span style="font-family: 'Courier New'; "><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>People._ID, People.NAME</span></span></span></pre><pre style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(250, 250, 250); margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; background-position: initial initial; background-repeat: initial initial; "><span lang="EN-US" style="font-size: 10.5pt; "><span style="color: rgb(0, 112, 0); "><span style="font-family: 'Courier New'; "><span>&nbsp;&nbsp;&nbsp; </span>};</span></span></span></pre><pre style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(250, 250, 250); margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; background-position: initial initial; background-repeat: initial initial; "><span lang="EN-US" style="font-size: 10.5pt; "><span style="color: rgb(0, 112, 0); font-family: 'Courier New'; ">&nbsp;</span></span></pre><pre style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(250, 250, 250); margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; background-position: initial initial; background-repeat: initial initial; "><span lang="EN-US" style="font-size: 10.5pt; "><span style="color: rgb(0, 112, 0); "><span style="font-family: 'Courier New'; ">Spinner s2 = (Spinner) findViewById(R.id.spinner2);</span></span></span></pre><pre style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(250, 250, 250); margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; background-position: initial initial; background-repeat: initial initial; "><span lang="EN-US" style="font-size: 10.5pt; "><span style="color: rgb(0, 112, 0); "><span style="font-family: 'Courier New'; ">Cursor cur = managedQuery(People.CONTENT_URI, PROJECTION, null, null);</span></span></span></pre><pre style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(250, 250, 250); margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; background-position: initial initial; background-repeat: initial initial; "><span lang="EN-US" style="font-size: 10.5pt; "><span style="color: rgb(0, 112, 0); "><span style="font-family: 'Courier New'; "><span>&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span></span></pre><pre style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(250, 250, 250); margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; background-position: initial initial; background-repeat: initial initial; "><span lang="EN-US" style="font-size: 10.5pt; "><span style="color: rgb(0, 112, 0); "><span style="font-family: 'Courier New'; ">SimpleCursorAdapter adapter2 = new SimpleCursorAdapter(this,</span></span></span></pre><pre style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(250, 250, 250); margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; background-position: initial initial; background-repeat: initial initial; "><span lang="EN-US" style="font-size: 10.5pt; "><span style="color: rgb(0, 112, 0); "><span style="font-family: 'Courier New'; "><span>&nbsp;&nbsp;&nbsp; </span>android.R.layout.simple_spinner_item, // Use a template</span></span></span></pre><pre style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(250, 250, 250); margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; background-position: initial initial; background-repeat: initial initial; "><span lang="EN-US" style="font-size: 10.5pt; "><span style="color: rgb(0, 112, 0); "><span style="font-family: 'Courier New'; "><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>// that displays a</span></span></span></pre><pre style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(250, 250, 250); margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; background-position: initial initial; background-repeat: initial initial; "><span lang="EN-US" style="font-size: 10.5pt; "><span style="color: rgb(0, 112, 0); "><span style="font-family: 'Courier New'; "><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>// text view</span></span></span></pre><pre style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(250, 250, 250); margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; background-position: initial initial; background-repeat: initial initial; "><span lang="EN-US" style="font-size: 10.5pt; "><span style="color: rgb(0, 112, 0); "><span style="font-family: 'Courier New'; "><span>&nbsp;&nbsp;&nbsp; </span>cur, // Give the cursor to the list adatper</span></span></span></pre><pre style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(250, 250, 250); margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; background-position: initial initial; background-repeat: initial initial; "><span lang="EN-US" style="font-size: 10.5pt; "><span style="color: rgb(0, 112, 0); "><span style="font-family: 'Courier New'; "><span>&nbsp;&nbsp;&nbsp; </span>new String[] {People.NAME}, // Map the NAME column in the</span></span></span></pre><pre style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(250, 250, 250); margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; background-position: initial initial; background-repeat: initial initial; "><span lang="EN-US" style="font-size: 10.5pt; "><span style="color: rgb(0, 112, 0); "><span style="font-family: 'Courier New'; "><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>// people database to...</span></span></span></pre><pre style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(250, 250, 250); margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; background-position: initial initial; background-repeat: initial initial; "><span lang="EN-US" style="font-size: 10.5pt; "><span style="color: rgb(0, 112, 0); "><span style="font-family: 'Courier New'; "><span>&nbsp;&nbsp;&nbsp; </span>new int[] {android.R.id.text1}); // The "text1" view defined in</span></span></span></pre><pre style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(250, 250, 250); margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; background-position: initial initial; background-repeat: initial initial; "><span lang="EN-US" style="font-size: 10.5pt; "><span style="color: rgb(0, 112, 0); "><span style="font-family: 'Courier New'; "><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>// the XML template</span></span></span></pre><pre style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(250, 250, 250); margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; background-position: initial initial; background-repeat: initial initial; "><span lang="EN-US" style="font-size: 10.5pt; "><span style="color: rgb(0, 112, 0); "><span style="font-family: 'Courier New'; "><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span> </span></span></span></pre><pre style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(250, 250, 250); margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; background-position: initial initial; background-repeat: initial initial; "><span lang="EN-US" style="font-size: 10.5pt; "><span style="color: rgb(0, 112, 0); "><span style="font-family: 'Courier New'; ">adapter2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);</span></span></span></pre><pre style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(250, 250, 250); margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; background-position: initial initial; background-repeat: initial initial; "><span lang="EN-US" style="font-size: 10.5pt; "><span style="color: rgb(0, 112, 0); "><span style="font-family: 'Courier New'; ">s2.setAdapter(adapter2);</span></span></span></pre></div><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 1em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; "><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); "><span style="line-height: 19px; font-family: 宋体; ">注意</span></span><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; ">Projection</span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); "><span style="line-height: 19px; font-family: 宋体; ">中的</span></span><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; ">People._ID</span><span style="line-height: 21px; font-family: 宋体; "><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); ">列是必须的，否则你将收到一个异常。</span><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; "></span></span></p><p style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 1em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; "><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); "><span style="line-height: 19px; font-family: 宋体; ">如果，在你的应用程序生命周期过程中，你改变了适配器所读取的下层数据，你应该调用</span></span><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; "><a href="file:///C:/android-sdk-windows-1.5_r3/docs/reference/android/widget/ArrayAdapter.html#notifyDataSetChanged()" style="text-decoration: none; color: rgb(51, 102, 153); "><span style="line-height: 19px; color: rgb(0, 102, 153); ">notifyDataSetChanged()</span></a></span><span style="line-height: 21px; font-family: 宋体; "><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); ">方法。这将通知附着视图数据已经更改，它需要刷新自己。</span><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; "></span></span></p><div style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; border-left-color: initial; padding-top: 6pt; "><p class="MsoNormal" align="left" style="padding-top: 0cm; padding-right: 0cm; padding-bottom: 0cm; padding-left: 0cm; margin-top: 18pt; margin-right: 0cm; margin-bottom: 12pt; margin-left: 0cm; text-align: left; "><strong><span style="line-height: 28px; font-size: 14.5pt; color: rgb(17, 17, 17); font-family: 宋体; ">处理用户的选择</span></strong><strong><span lang="EN-US" style="line-height: 28px; font-size: 14.5pt; color: rgb(17, 17, 17); font-family: Arial, sans-serif; ">Handling User Selections</span></strong><strong><span lang="EN-US" style="line-height: 28px; font-size: 14.5pt; color: rgb(17, 17, 17); font-family: Arial, sans-serif; "></span></strong></p></div><p class="MsoNormal" align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 12pt; margin-left: 0cm; line-height: 15.6pt; text-align: left; "><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">你通过设置类的</span><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; "><a href="file:///C:/android-sdk-windows-1.5_r3/docs/reference/android/widget/AdapterView.OnItemClickListener.html" style="text-decoration: none; color: rgb(51, 102, 153); "><span style="line-height: 19px; color: rgb(0, 102, 153); ">AdapterView.OnItemClickListener</span></a></span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">成员变量为一个侦听器来处理用户的选择并且捕获选择变化。</span><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; "></span></p><div style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(250, 250, 250); margin-left: 11.9pt; margin-right: 0cm; border-left-color: rgb(204, 204, 204); padding-top: 8pt; padding-right: 8pt; padding-bottom: 8pt; padding-left: 8pt; "><pre style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(250, 250, 250); margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; background-position: initial initial; background-repeat: initial initial; "><span lang="EN-US" style="font-size: 10.5pt; "><span style="color: rgb(0, 112, 0); "><span style="font-family: 'Courier New'; ">// Create a message handling object as an anonymous class.</span></span></span></pre><pre style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(250, 250, 250); margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; background-position: initial initial; background-repeat: initial initial; "><span lang="EN-US" style="font-size: 10.5pt; "><span style="color: rgb(0, 112, 0); "><span style="font-family: 'Courier New'; ">private OnItemClickListener mMessageClickedHandler = new OnItemClickListener() {</span></span></span></pre><pre style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(250, 250, 250); margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; background-position: initial initial; background-repeat: initial initial; "><span lang="EN-US" style="font-size: 10.5pt; "><span style="color: rgb(0, 112, 0); "><span style="font-family: 'Courier New'; "><span>&nbsp;&nbsp;&nbsp; </span>public void onItemClick(AdapterView parent, View v, int position, long id)</span></span></span></pre><pre style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(250, 250, 250); margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; background-position: initial initial; background-repeat: initial initial; "><span lang="EN-US" style="font-size: 10.5pt; "><span style="color: rgb(0, 112, 0); "><span style="font-family: 'Courier New'; "><span>&nbsp;&nbsp;&nbsp; </span>{</span></span></span></pre><pre style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(250, 250, 250); margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; background-position: initial initial; background-repeat: initial initial; "><span lang="EN-US" style="font-size: 10.5pt; "><span style="color: rgb(0, 112, 0); "><span style="font-family: 'Courier New'; "><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>// Display a messagebox.</span></span></span></pre><pre style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(250, 250, 250); margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; background-position: initial initial; background-repeat: initial initial; "><span lang="EN-US" style="font-size: 10.5pt; "><span style="color: rgb(0, 112, 0); "><span style="font-family: 'Courier New'; "><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>Toast.makeText(mContext,"You've got an event",Toast.LENGTH_SHORT).show();</span></span></span></pre><pre style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(250, 250, 250); margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; background-position: initial initial; background-repeat: initial initial; "><span lang="EN-US" style="font-size: 10.5pt; "><span style="color: rgb(0, 112, 0); "><span style="font-family: 'Courier New'; "><span>&nbsp;&nbsp;&nbsp; </span>}</span></span></span></pre><pre style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(250, 250, 250); margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; background-position: initial initial; background-repeat: initial initial; "><span lang="EN-US" style="font-size: 10.5pt; "><span style="color: rgb(0, 112, 0); "><span style="font-family: 'Courier New'; ">};</span></span></span></pre><pre style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(250, 250, 250); margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; background-position: initial initial; background-repeat: initial initial; "><span lang="EN-US" style="font-size: 10.5pt; "><span style="color: rgb(0, 112, 0); font-family: 'Courier New'; ">&nbsp;</span></span></pre><pre style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(250, 250, 250); margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; background-position: initial initial; background-repeat: initial initial; "><span lang="EN-US" style="font-size: 10.5pt; "><span style="color: rgb(0, 112, 0); "><span style="font-family: 'Courier New'; ">// Now hook into our object and set its onItemClickListener member</span></span></span></pre><pre style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(250, 250, 250); margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; background-position: initial initial; background-repeat: initial initial; "><span lang="EN-US" style="font-size: 10.5pt; "><span style="color: rgb(0, 112, 0); "><span style="font-family: 'Courier New'; ">// to our class handler object.</span></span></span></pre><pre style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(250, 250, 250); margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; background-position: initial initial; background-repeat: initial initial; "><span lang="EN-US" style="font-size: 10.5pt; "><span style="color: rgb(0, 112, 0); "><span style="font-family: 'Courier New'; ">mHistoryView = (ListView)findViewById(R.id.history);</span></span></span></pre><pre style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(250, 250, 250); margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; background-position: initial initial; background-repeat: initial initial; "><span lang="EN-US" style="font-size: 10.5pt; "><span style="color: rgb(0, 112, 0); "><span style="font-family: 'Courier New'; ">mHistoryView.setOnItemClickListener(mMessageClickedHandler); </span></span></span></pre></div><p class="MsoNormal" align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 12pt; margin-left: 0cm; line-height: 15.6pt; text-align: left; "><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; ">&nbsp;</span></p><p class="MsoNormal" align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 6pt; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(221, 240, 242); line-height: 15.6pt; text-align: left; background-position: initial initial; background-repeat: initial initial; "><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">想了解更多有关如何创建不同</span><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; ">AdapterViews</span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">讨论，请阅读以下教程：</span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; ">&nbsp;</span><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; "><a href="file:///C:/android-sdk-windows-1.5_r3/docs/guide/tutorials/views/hello-spinner.html" style="text-decoration: none; color: rgb(51, 102, 153); "><span style="line-height: 19px; color: rgb(0, 102, 153); ">Hello Spinner</span></a>,&nbsp;<a href="file:///C:/android-sdk-windows-1.5_r3/docs/guide/tutorials/views/hello-listview.html" style="text-decoration: none; color: rgb(51, 102, 153); "><span style="line-height: 19px; color: rgb(0, 102, 153); ">Hello ListView</span></a>,&nbsp;</span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">和</span><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Arial, sans-serif; "><a href="file:///C:/android-sdk-windows-1.5_r3/docs/guide/tutorials/views/hello-gridview.html" style="text-decoration: none; color: rgb(51, 102, 153); "><span style="line-height: 19px; color: rgb(0, 102, 153); ">Hello GridView</span></a></span><span style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: 宋体; ">。</span></p></span></div><img src ="http://www.cnitblog.com/seedshopezhong/aggbug/65211.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/seedshopezhong/" target="_blank">seedshopezhong</a> 2010-04-11 21:51 <a href="http://www.cnitblog.com/seedshopezhong/archive/2010/04/11/65211.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Android开发指南-用户界面-风格和主题</title><link>http://www.cnitblog.com/seedshopezhong/archive/2010/04/11/65210.html</link><dc:creator>seedshopezhong</dc:creator><author>seedshopezhong</author><pubDate>Sun, 11 Apr 2010 13:47:00 GMT</pubDate><guid>http://www.cnitblog.com/seedshopezhong/archive/2010/04/11/65210.html</guid><wfw:comment>http://www.cnitblog.com/seedshopezhong/comments/65210.html</wfw:comment><comments>http://www.cnitblog.com/seedshopezhong/archive/2010/04/11/65210.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/seedshopezhong/comments/commentRss/65210.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/seedshopezhong/services/trackbacks/65210.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 转自：http://blog.csdn.net/iefreer/archive/2009/09/25/4595533.aspx应用风格和主题Applying Styles and Themes当设计应用程序时，你可以用风格和主题来统一格式化各种屏幕和UI元素。l&nbsp;&nbsp;&nbsp;风格是一个包含一种或者多种格式化属性的集合，你可以将其作为一个单位用在布局XML单个元素当中。比如，你...&nbsp;&nbsp;<a href='http://www.cnitblog.com/seedshopezhong/archive/2010/04/11/65210.html'>阅读全文</a><img src ="http://www.cnitblog.com/seedshopezhong/aggbug/65210.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/seedshopezhong/" target="_blank">seedshopezhong</a> 2010-04-11 21:47 <a href="http://www.cnitblog.com/seedshopezhong/archive/2010/04/11/65210.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Android开发指南-用户界面-用户通知</title><link>http://www.cnitblog.com/seedshopezhong/archive/2010/04/11/65209.html</link><dc:creator>seedshopezhong</dc:creator><author>seedshopezhong</author><pubDate>Sun, 11 Apr 2010 13:43:00 GMT</pubDate><guid>http://www.cnitblog.com/seedshopezhong/archive/2010/04/11/65209.html</guid><wfw:comment>http://www.cnitblog.com/seedshopezhong/comments/65209.html</wfw:comment><comments>http://www.cnitblog.com/seedshopezhong/archive/2010/04/11/65209.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/seedshopezhong/comments/commentRss/65209.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/seedshopezhong/services/trackbacks/65209.html</trackback:ping><description><![CDATA[<span  style="font-family: verdana, sans-serif; font-size: 14px; line-height: 21px; "><p class="MsoNormal" align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 4.4pt; margin-left: 0cm; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(226, 226, 226); text-align: left; background-position: initial initial; background-repeat: initial initial; "><font  color="#333333" face="宋体" size="3"><span  style="font-size: 12px; line-height: 18px;"><strong>转载于：<span  style="color: rgb(0, 0, 0); font-family: verdana, sans-serif; font-weight: normal; line-height: 21px; font-size: 14px; "><a href="http://blog.csdn.net/iefreer/archive/2009/09/25/4594818.aspx">http://blog.csdn.net/iefreer/archive/2009/09/25/4594818.aspx</a></span></strong></span></font></p><p class="MsoNormal" align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 4.4pt; margin-left: 0cm; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(226, 226, 226); text-align: left; background-position: initial initial; background-repeat: initial initial; "><strong><span style="line-height: 18px; font-size: 9pt; color: rgb(51, 51, 51); font-family: 宋体; ">通知用户<span lang="EN-US" style="line-height: 18px; ">Notifying the User</span></span></strong></p><p class="MsoNormal" align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 12pt; margin-left: 0cm; line-height: 15.6pt; text-align: left; "><span style="line-height: 18px; font-size: 9pt; color: rgb(51, 51, 51); font-family: 宋体; ">某些情况下需要通知用户你的应用程序中发生了一个事件。一些事件请求用户应答而另外一些则不需要。比如：</span></p><p class="MsoNormal" align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 110pt; text-indent: -18pt; line-height: 15.6pt; text-align: left; "><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Symbol; "><span style="line-height: 19px; ">&#183;<span style="line-height: normal; font: normal normal normal 7pt/normal 'Times New Roman'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span><span style="line-height: 18px; font-size: 9pt; color: rgb(51, 51, 51); font-family: 宋体; ">当一个事件比如保存文件结束时，应该出现一条消息确认保存成功。</span></p><p class="MsoNormal" align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 110pt; text-indent: -18pt; line-height: 15.6pt; text-align: left; "><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Symbol; "><span style="line-height: 19px; ">&#183;<span style="line-height: normal; font: normal normal normal 7pt/normal 'Times New Roman'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span><span style="line-height: 18px; font-size: 9pt; color: rgb(51, 51, 51); font-family: 宋体; ">如果一个后台运行的应用程序需要用户关注，这个应用程序应该创建一个通知来允许用户在方便时进行应答。</span></p><p class="MsoNormal" align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 110pt; text-indent: -18pt; line-height: 15.6pt; text-align: left; "><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Symbol; "><span style="line-height: 19px; ">&#183;<span style="line-height: normal; font: normal normal normal 7pt/normal 'Times New Roman'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span><span style="line-height: 18px; font-size: 9pt; color: rgb(51, 51, 51); font-family: 宋体; ">如果这个应用程序在执行一个用户必须等待的任务（比如家在一个文件），那么应用程序应该显示一个盘旋的进度轮或进度条。</span></p><p class="MsoNormal" align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 12pt; margin-left: 0cm; line-height: 15.6pt; text-align: left; "><span style="line-height: 18px; font-size: 9pt; color: rgb(51, 51, 51); font-family: 宋体; ">所有这些通知任务可以通过一个不同的技术获取到：</span></p><p class="MsoNormal" align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 110pt; text-indent: -18pt; line-height: 15.6pt; text-align: left; "><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Symbol; "><span style="line-height: 19px; ">&#183;<span style="line-height: normal; font: normal normal normal 7pt/normal 'Times New Roman'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span><span style="line-height: 18px; font-size: 9pt; color: rgb(51, 51, 51); font-family: 宋体; ">一个消息条通知<span lang="EN-US" style="line-height: 18px; "><a href="file:///C:/android-sdk-windows-1.5_r3/docs/guide/topics/ui/notifiers/index.html#Toast" style="text-decoration: none; color: rgb(51, 102, 153); "><span style="line-height: 18px; color: rgb(0, 102, 153); ">Toast Notification</span></a>,&nbsp;</span>用于从后台出现的简短信息。<span lang="EN-US" style="line-height: 18px; ">for brief messages that come from the background.</span></span></p><p class="MsoNormal" align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 110pt; text-indent: -18pt; line-height: 15.6pt; text-align: left; "><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Symbol; "><span style="line-height: 19px; ">&#183;<span style="line-height: normal; font: normal normal normal 7pt/normal 'Times New Roman'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span><span style="line-height: 18px; font-size: 9pt; color: rgb(51, 51, 51); font-family: 宋体; ">一个状态条通知<span lang="EN-US" style="line-height: 18px; ">A&nbsp;<a href="file:///C:/android-sdk-windows-1.5_r3/docs/guide/topics/ui/notifiers/index.html#StatusBar" style="text-decoration: none; color: rgb(51, 102, 153); "><span style="line-height: 18px; color: rgb(0, 102, 153); ">Status Bar Notification</span></a>,&nbsp;</span>用于来自后台的持续提醒并请求用户应答。</span></p><p class="MsoNormal" align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 110pt; text-indent: -18pt; line-height: 15.6pt; text-align: left; "><span lang="EN-US" style="line-height: 19px; font-size: 10pt; color: rgb(51, 51, 51); font-family: Symbol; "><span style="line-height: 19px; ">&#183;<span style="line-height: normal; font: normal normal normal 7pt/normal 'Times New Roman'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span><span style="line-height: 18px; font-size: 9pt; color: rgb(51, 51, 51); font-family: 宋体; ">一个对话框通知<span lang="EN-US" style="line-height: 18px; ">A&nbsp;<a href="file:///C:/android-sdk-windows-1.5_r3/docs/guide/topics/ui/notifiers/index.html#Dialog" style="text-decoration: none; color: rgb(51, 102, 153); "><span style="line-height: 18px; color: rgb(0, 102, 153); ">Dialog Notification</span></a>,&nbsp;</span>用于活动相关的通知。</span></p><p class="MsoNormal" align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 12pt; margin-left: 0cm; line-height: 15.6pt; text-align: left; "><span style="line-height: 18px; font-size: 9pt; color: rgb(51, 51, 51); font-family: 宋体; ">这篇文档总结了用来通知用户的所有这些技术并包含相应的链接。</span></p><div style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; border-left-color: initial; padding-top: 6pt; "><p class="MsoNormal" align="left" style="padding-top: 0cm; padding-right: 0cm; padding-bottom: 0cm; padding-left: 0cm; margin-top: 18pt; margin-right: 0cm; margin-bottom: 12pt; margin-left: 0cm; text-align: left; "><strong><span style="line-height: 18px; font-size: 9pt; color: rgb(17, 17, 17); font-family: 宋体; ">消息条通知<span lang="EN-US" style="line-height: 18px; ">Toast Notification</span></span></strong></p></div><p class="MsoNormal" align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; ">&nbsp;</p><p class="MsoNormal" align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 12pt; margin-left: 0cm; line-height: 15.6pt; text-align: left; "><img src="http://p.blog.csdn.net/images/p_blog_csdn_net/iefreer/EntryImages/20090925/toast.png" alt="" width="200" height="140" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; ">&nbsp;</p><p class="MsoNormal" align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 12pt; margin-left: 0cm; line-height: 15.6pt; text-align: left; "><span style="line-height: 18px; font-size: 9pt; color: rgb(51, 51, 51); font-family: 宋体; ">一个消息条通知是一个在窗口表面弹出的信息。它只填充内容所需的空间并且用户当前活动仍然保持可见和可交互。这个通知自动渐入渐出，而且不接受交互事件。因为消息条可以从一个后台服务<span lang="EN-US" style="line-height: 18px; "><a href="file:///C:/android-sdk-windows-1.5_r3/docs/reference/android/app/Service.html" style="text-decoration: none; color: rgb(51, 102, 153); "><span style="line-height: 18px; color: rgb(0, 102, 153); ">Service</span></a></span>中创建，即便应用程序不可见，它也将呈现出来。</span></p><p class="MsoNormal" align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 12pt; margin-left: 0cm; line-height: 15.6pt; text-align: left; "><span style="line-height: 18px; font-size: 9pt; color: rgb(51, 51, 51); font-family: 宋体; ">一个消息条是用来显示简短文本信息的最好方法，比如<span lang="EN-US" style="line-height: 18px; ">&#8220;</span>文件已保存<span lang="EN-US" style="line-height: 18px; ">&#8221;</span>，当你很确信用户正在关注屏幕时。一个消息条不能接受用户交互事件；如果你希望用户应答并采取相应动作，请考虑使用一个状态条通知<span lang="EN-US" style="line-height: 18px; "><a href="file:///C:/android-sdk-windows-1.5_r3/docs/guide/topics/ui/notifiers/index.html#StatusBar" style="text-decoration: none; color: rgb(51, 102, 153); "><span style="line-height: 18px; color: rgb(0, 102, 153); ">Status Bar Notification</span></a></span>。</span></p><p class="MsoNormal" align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 12pt; margin-left: 0cm; line-height: 15.6pt; text-align: left; "><span style="line-height: 18px; font-size: 9pt; color: rgb(51, 51, 51); font-family: 宋体; ">更多信息，请参考创建消息条通知<span lang="EN-US" style="line-height: 18px; "><a href="file:///C:/android-sdk-windows-1.5_r3/docs/guide/topics/ui/notifiers/toasts.html" style="text-decoration: none; color: rgb(51, 102, 153); "><span style="line-height: 18px; color: rgb(0, 102, 153); ">Creating Toast Notifications</span></a>.</span></span></p><div style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; border-left-color: initial; padding-top: 6pt; "><p class="MsoNormal" align="left" style="padding-top: 0cm; padding-right: 0cm; padding-bottom: 0cm; padding-left: 0cm; margin-top: 18pt; margin-right: 0cm; margin-bottom: 12pt; margin-left: 0cm; text-align: left; "><strong><span style="line-height: 18px; font-size: 9pt; color: rgb(17, 17, 17); font-family: 宋体; ">状态条通知<span lang="EN-US" style="line-height: 18px; ">Status Bar Notification</span></span></strong></p></div><p class="MsoNormal" align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; ">&nbsp;</p><p class="MsoNormal" align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 12pt; margin-left: 0cm; line-height: 15.6pt; text-align: left; "><span style="line-height: 18px; font-size: 9pt; color: rgb(51, 51, 51); font-family: 宋体; "><img src="http://p.blog.csdn.net/images/p_blog_csdn_net/iefreer/EntryImages/20090925/notifications_window.png" alt="" width="200" height="157" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; "></span></p><p class="MsoNormal" align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 12pt; margin-left: 0cm; line-height: 15.6pt; text-align: left; "><span style="line-height: 18px; font-size: 9pt; color: rgb(51, 51, 51); font-family: 宋体; ">一个状态条通知添加一个图标到系统状态栏上（以及一个可选的滚动条文本信息）以及在这个<span lang="EN-US" style="line-height: 18px; ">&#8220;</span>通知<span lang="EN-US" style="line-height: 18px; ">&#8221;</span>窗口中的一个扩展消息。当用户选择这个扩展消息时，<span lang="EN-US" style="line-height: 18px; ">Android</span>发出这个通知所定义的一个意图（通常是启动一个活动）。你也可以配置这个通知来通过一个声音，震动和设备上的闪烁灯来警告用户。</span></p><p class="MsoNormal" align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 12pt; margin-left: 0cm; line-height: 15.6pt; text-align: left; "><span style="line-height: 18px; font-size: 9pt; color: rgb(51, 51, 51); font-family: 宋体; ">当你的应用程序以后台服务运行并需要通知用户事件时，这类通知是一个理想的方式。如果你需要在活动仍处于焦点下时警告用户一个发生的事件，请考虑使用对话框通知<span lang="EN-US" style="line-height: 18px; "><a href="file:///C:/android-sdk-windows-1.5_r3/docs/guide/topics/ui/notifiers/index.html#Dialog" style="text-decoration: none; color: rgb(51, 102, 153); "><span style="line-height: 18px; color: rgb(0, 102, 153); ">Dialog Notification</span></a>&nbsp;</span>。</span></p><p class="MsoNormal" align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 12pt; margin-left: 0cm; line-height: 15.6pt; text-align: left; "><span style="line-height: 18px; font-size: 9pt; color: rgb(51, 51, 51); font-family: 宋体; ">更多信息，请参考创建状态条通知<span lang="EN-US" style="line-height: 18px; "><a href="file:///C:/android-sdk-windows-1.5_r3/docs/guide/topics/ui/notifiers/notifications.html" style="text-decoration: none; color: rgb(51, 102, 153); "><span style="line-height: 18px; color: rgb(0, 102, 153); ">Creating Status Bar Notifications</span></a></span>。</span></p><div style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; border-left-color: initial; padding-top: 6pt; "><p class="MsoNormal" align="left" style="padding-top: 0cm; padding-right: 0cm; padding-bottom: 0cm; padding-left: 0cm; margin-top: 18pt; margin-right: 0cm; margin-bottom: 12pt; margin-left: 0cm; text-align: left; "><strong><span style="line-height: 18px; font-size: 9pt; color: rgb(17, 17, 17); font-family: 宋体; ">对话框通知<span lang="EN-US" style="line-height: 18px; ">Dialog Notification</span></span></strong></p></div><p class="MsoNormal" align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; ">&nbsp;</p><p class="MsoNormal" align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 12pt; margin-left: 0cm; line-height: 15.6pt; text-align: left; "><span style="line-height: 18px; font-size: 9pt; color: rgb(51, 51, 51); font-family: 宋体; "><img src="http://p.blog.csdn.net/images/p_blog_csdn_net/iefreer/EntryImages/20090925/dialog_progress_spinning.png" alt="" width="200" height="87" style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; "></span></p><p class="MsoNormal" align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 12pt; margin-left: 0cm; line-height: 15.6pt; text-align: left; "><span style="line-height: 18px; font-size: 9pt; color: rgb(51, 51, 51); font-family: 宋体; ">一个对话框通常是出现在当前活动前面的一个小窗口。背后的活动丢失焦点而由这个对话框接受所有的用户交互。对话框通常用做和运行中应用程序直接相关的通知和短暂活动。</span></p><p class="MsoNormal" align="left" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0cm; margin-right: 0cm; margin-bottom: 12pt; margin-left: 0cm; line-height: 15.6pt; text-align: left; "><span style="line-height: 18px; font-size: 9pt; color: rgb(51, 51, 51); font-family: 宋体; ">你应该使用对话框来显示一个进度条或者一个需要用户确认的短消息（比如带有<span lang="EN-US" style="line-height: 18px; ">&#8220;</span>确认<span lang="EN-US" style="line-height: 18px; ">&#8221;</span>和<span lang="EN-US" style="line-height: 18px; ">&#8220;</span>取消<span lang="EN-US" style="line-height: 18px; ">&#8221;</span>按钮的一个警告）。你也可以把对话框作为构成应用程序界面整体的组件以及用于除了通知之外的其它目的。要完整讨论所有可用对话框资源，包括用作通知，请参考创建对话框<span lang="EN-US" style="line-height: 18px; "><a href="file:///C:/android-sdk-windows-1.5_r3/docs/guide/topics/ui/dialogs.html" style="text-decoration: none; color: rgb(51, 102, 153); "><span style="line-height: 18px; color: rgb(0, 102, 153); ">Creating Dialogs</span></a></span>。</span></p></span>
<img src ="http://www.cnitblog.com/seedshopezhong/aggbug/65209.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/seedshopezhong/" target="_blank">seedshopezhong</a> 2010-04-11 21:43 <a href="http://www.cnitblog.com/seedshopezhong/archive/2010/04/11/65209.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>