??xml version="1.0" encoding="utf-8" standalone="yes"?>精品福利在线,日韩一区中文,亚洲高清不卡http://www.aygfsteel.com/level0/category/47451.htmlzh-cnWed, 09 Feb 2011 00:35:48 GMTWed, 09 Feb 2011 00:35:48 GMT602011.01.02 一些基本的Layout控ghttp://www.aygfsteel.com/level0/articles/342157.htmllevel0level0Sun, 02 Jan 2011 04:00:00 GMThttp://www.aygfsteel.com/level0/articles/342157.htmlhttp://www.aygfsteel.com/level0/comments/342157.htmlhttp://www.aygfsteel.com/level0/articles/342157.html#Feedback0http://www.aygfsteel.com/level0/comments/commentRss/342157.htmlhttp://www.aygfsteel.com/level0/services/trackbacks/342157.html阅读全文

level0 2011-01-02 12:00 发表评论
]]>
cmd100论坛Mars老师的视频目录整理(1?7Q?/title><link>http://www.aygfsteel.com/level0/articles/341553.html</link><dc:creator>level0</dc:creator><author>level0</author><pubDate>Sun, 26 Dec 2010 02:51:00 GMT</pubDate><guid>http://www.aygfsteel.com/level0/articles/341553.html</guid><wfw:comment>http://www.aygfsteel.com/level0/comments/341553.html</wfw:comment><comments>http://www.aygfsteel.com/level0/articles/341553.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/level0/comments/commentRss/341553.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/level0/services/trackbacks/341553.html</trackback:ping><description><![CDATA[<style type="text/css">p { margin-bottom: 0.21cm; }code.cjk { font-family: "DejaVu Sans",monospace; }code.ctl { font-family: "DejaVu Sans Mono",monospace; }a:link { }</style> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">01-01-Android</font>q_一日游</p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">1</font>Q观?font face="DejaVu Serif, serif">Android</font>的全景地图:</p> <p style="margin-bottom: 0cm;"> l出?font face="DejaVu Serif, serif">Google</font>官方发布?font face="DejaVu Serif, serif">Android</font>?font face="DejaVu Serif, serif">4</font>层结构图。最底层?font face="DejaVu Serif, serif">Linux Kernel</font>Q主要一些与g相关的最底层的操作,比如各种驱动Q内存管理,q程理{)Q第二层?font face="DejaVu Serif, serif">Libraries</font>?font face="DejaVu Serif, serif">Android runtime</font>Q?font face="DejaVu Serif, serif">Library</font>是一堆由<font face="DejaVu Serif, serif">C/C++</font>~写的基库,<font face="DejaVu Serif, serif">Android</font>主要包括一?font face="DejaVu Serif, serif">Dalvik</font>虚拟机和<font face="DejaVu Serif, serif">core libraries</font>Q,W三层是<font face="DejaVu Serif, serif">application framework</font>Q顾名思义是各U的框架Q用于对W四层的应用提供接口和进行管理)Q最高层?font face="DejaVu Serif, serif">applications</font>Q就是^常呢些直接和手机用户q行交互的东西)?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">2</font>Q?font face="DejaVu Serif, serif">Android VS Iphone</font></p> <p style="margin-bottom: 0cm;"> 大致Cl了两个手机操作pȝq_之间的差异和两个公司之间的敌对关pR?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">3</font>Q?font face="DejaVu Serif, serif">Android</font>常用lgQ四大天王)</p> <p style="margin-bottom: 0cm;"> <font face="DejaVu Serif, serif">Activity</font>Q最漂亮Q门面功夫要做?/p> <p style="margin-bottom: 0cm;"> <font face="DejaVu Serif, serif">Intent</font>Q最牛力Q运输数据全赖他?/p> <p style="margin-bottom: 0cm;"> <font face="DejaVu Serif, serif">Service</font>Q最低调Q后台服务看不到?/p> <p style="margin-bottom: 0cm;"> <font face="DejaVu Serif, serif">Content Provider</font>Q最博学Q数据存N中地?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">4</font>Q?font face="DejaVu Serif, serif">Android</font>开发工?/p> <p style="margin-bottom: 0cm;"> 常用<font face="DejaVu Serif, serif">IDE</font>Q?font face="DejaVu Serif, serif">Eclipse</font>Q配上插?font face="DejaVu Serif, serif">ADT</font>Q?/p> <p style="margin-bottom: 0cm;"> 开发工具包Q?font face="DejaVu Serif, serif">Android SDK</font>Q?font face="DejaVu Serif, serif">2010.12.06</font>发布?font face="DejaVu Serif, serif">2.3</font>的版本) </p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">5</font>Q参?font face="DejaVu Serif, serif">Android</font>王国的金?/p> <p style="margin-bottom: 0cm;"> 大致介绍了通过<font face="DejaVu Serif, serif">Android</font>的两U赚qҎQ卖应用和嵌入广告。(<font face="DejaVu Serif, serif">Mars</font>推荐W二U)</p> <p style="margin-bottom: 0cm;"> </p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">01-02-</font>搭徏<font face="DejaVu Serif, serif">Android</font>开发环?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">1</font>Q?font face="DejaVu Serif, serif">Android SDK</font>的安?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">2</font>Q?font face="DejaVu Serif, serif">ADT</font>的安装与配置</p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">3</font>Q?font face="DejaVu Serif, serif">Android</font>的模拟器配置</p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">/***</font>官方l出了很详细的安装文档,q里不详l展开Q步骤大致如下:</p> <p style="margin-bottom: 0cm;">Q?font face="DejaVu Serif, serif">1</font>Q安装和配置<font face="DejaVu Serif, serif">JDK</font>?font face="DejaVu Serif, serif">JRE1.5</font>Q?font face="DejaVu Serif, serif">1.6</font>更佳Q?/p> <p style="margin-bottom: 0cm;">Q?font face="DejaVu Serif, serif">2</font>Q安装带<font face="DejaVu Serif, serif">JavaSDK</font>?font face="DejaVu Serif, serif">Eclipse3.4</font>或?font face="DejaVu Serif, serif">3.5</font></p> <p style="margin-bottom: 0cm;">Q?font face="DejaVu Serif, serif">3</font>Q下?font face="DejaVu Serif, serif">Android SDK</font>Q较为准的说法?font face="DejaVu Serif, serif">Android SDK download platform</font>Q?/p> <p style="margin-bottom: 0cm;">Q?font face="DejaVu Serif, serif">4</font>Q在<font face="DejaVu Serif, serif">Eclipse</font>中安?font face="DejaVu Serif, serif">ADT</font>插g</p> <p style="margin-bottom: 0cm;">Q?font face="DejaVu Serif, serif">5</font>Q配|?font face="DejaVu Serif, serif">Android SDK</font>的\?/p> <p style="margin-bottom: 0cm;">Q?font face="DejaVu Serif, serif">6</font>Q下载虚拟机和相x档(和一些选用的功能)<font face="DejaVu Serif, serif">***/</font></p> <p style="margin-bottom: 0cm;"><br /> </p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">01-03-say_hello_to_Android</font></p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">1</font>Q创Z?font face="DejaVu Serif, serif">Android</font>应用E序的步?/p> <p style="margin-bottom: 0cm;"> Q略Q?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">2</font>Q?font face="DejaVu Serif, serif">Android</font>应用E序目录l构</p> <p style="margin-bottom: 0cm;"> <font face="DejaVu Serif, serif">src:short for source</font>Q存放源代码的地斏V?/p> <p style="margin-bottom: 0cm;"> <font face="DejaVu Serif, serif">gen</font>Q主要就?font face="DejaVu Serif, serif">R.java</font>文g存放的位|?/p> <p style="margin-bottom: 0cm;"> <font face="DejaVu Serif, serif">asset:</font>存放资源文g的文件夹Q不会在<font face="DejaVu Serif, serif">R.java</font>中自动生成对应的数据?/p> <p style="margin-bottom: 0cm;"> <font face="DejaVu Serif, serif">res</font>Q?font face="DejaVu Serif, serif">short for resource</font>Q存放资源文件的文g夹,q在<font face="DejaVu Serif, serif">R.java</font>里面有对应的数据?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">3</font>Q?font face="DejaVu Serif, serif">AndroidManifest.xml</font>文g的作?/p> <p style="margin-bottom: 0cm;"> 每编写一个活动都需要在q里注册?/p> <p style="margin-bottom: 0cm;"> 其中?font face="DejaVu Serif, serif"><intent filter></font>是区分应用启动时优先启动哪个<font face="DejaVu Serif, serif">Activity</font>的标记?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">4</font>Q?font face="DejaVu Serif, serif">Android</font>相关文g资源的作?/p> <p style="margin-bottom: 0cm;"> 提到了一个名?#8220;键值对”的概念(<font face="DejaVu Serif, serif">XML</font>的?要查阅相兌料了Q?/p> <p style="margin-bottom: 0cm;"><br /> </p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">01-04-Activity</font>初步</p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">1</font>Q?font face="DejaVu Serif, serif">Activity</font>的主要作?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">2</font>Q创Z?font face="DejaVu Serif, serif">Activity</font>的方?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">3</font>Q在<font face="DejaVu Serif, serif">AndroidManifest.xml</font>文g当中注册应用<font face="DejaVu Serif, serif">Activity</font>的方?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">4</font>Q在<font face="DejaVu Serif, serif">Android</font>当中d控g的方?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">/***</font>按作者的说法是:<font face="DejaVu Serif, serif">Activity</font>不好译Q反正就是理解成一个与用户q行交互的界面,但是一?font face="DejaVu Serif, serif">Activity</font>本n只是一个近乎空白容器,要实C互界面就需要在上面攑օ各种适用的控件?/p> <p style="margin-bottom: 0cm;"> 一?font face="DejaVu Serif, serif">Activity</font>要?font face="DejaVu Serif, serif">Activity</font>c,而且臛_要实?font face="DejaVu Serif, serif">onCreate()</font>的方法。ƈ且记得要?font face="DejaVu Serif, serif">AndroidManifest.xml</font>中进行注?/p> <p style="margin-bottom: 0cm;"> 每个<font face="DejaVu Serif, serif">Activity</font>一般都对应着一?font face="DejaVu Serif, serif">layout</font>Q在<font face="DejaVu Serif, serif">layout</font>中定义和攄控gQ控件内容可以直接在<font face="DejaVu Serif, serif">xml</font>中编写,?font face="DejaVu Serif, serif">Mars</font>的做法是d<font face="DejaVu Serif, serif">id</font>Q然后在源代码中?font face="DejaVu Serif, serif">findViewById()</font>Ҏ来进行引用和写入内容。(感觉?font face="DejaVu Serif, serif">xml</font>里面写比较方便,用着手是了)<font face="DejaVu Serif, serif">***/</font></p> <p style="margin-bottom: 0cm;"><br /> </p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">01-05-Activity</font>?font face="DejaVu Serif, serif">Intent</font></p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">1</font>Q多?font face="DejaVu Serif, serif">Activity</font>之间的关p?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">2</font>Q?font face="DejaVu Serif, serif">Intent</font>的基本作?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">3</font>Q在一?font face="DejaVu Serif, serif">Activity</font>中启动另一?font face="DejaVu Serif, serif">Activity</font>的方?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">4</font>Q?font face="DejaVu Serif, serif">Intent</font>?font face="DejaVu Serif, serif">Activity</font>中传递数据的基本Ҏ</p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">/***</font>可以?font face="DejaVu Serif, serif">Intent</font>对多?font face="DejaVu Serif, serif">Activity</font>之间切换Q这?font face="DejaVu Serif, serif">Activity</font>可以在同一个应用程序当中也可以不再同一个应用程序当中)?font face="DejaVu Serif, serif">Intent</font>可以?font face="DejaVu Serif, serif">Activity</font>之间q行切换和传输数据(<font face="DejaVu Serif, serif">data</font>或?font face="DejaVu Serif, serif">Extras</font>键值对Q?font face="DejaVu Serif, serif">Intent</font>的作用不限于启动zdQ?font face="DejaVu Serif, serif">Intent</font>可以启动很多<font face="DejaVu Serif, serif">component</font>Q比?font face="DejaVu Serif, serif">broadcast</font>{?font face="DejaVu Serif, serif">Mars</font>认ؓ<font face="DejaVu Serif, serif">Intent</font>虽然一般被译成意图但实不是太好的翻译,他目前也没有惛_较好的就暂时先吧<font face="DejaVu Serif, serif">Intent</font>看成一U请求?/p> <p style="margin-bottom: 0cm;">?font face="DejaVu Serif, serif">ppt</font>Q?/p> <p style="margin-bottom: 0cm;">一?font face="DejaVu Serif, serif">Intent</font>对象包含了一l信息:</p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">1,Component name </font>启动lg的名Uͼlg可以是活动啊q播啊很多)</p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">2,Action </font>要求lg执行的动作(pȝl除了很多参敎ͼ参看<font face="DejaVu Serif, serif">documentation</font>Q?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">3,Data </font>由原lg到新lg传输的数?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">4,Category </font>没讲</p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">5,Extras </font>也是数据Q不q是键值对Q什么是键值对Q理解成两个字符ԌQ?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">6,Flags </font>没讲</p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">***/</font></p> <p style="margin-bottom: 0cm;"><br /> </p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">01-06-Android</font>当中的常见控?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">1</font>Q?font face="DejaVu Serif, serif">TextView</font>的用方法(昄cd文本框)</p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">2</font>Q?font face="DejaVu Serif, serif">EditText</font>的用方法(可输入类型文本框Q?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">3</font>Q?font face="DejaVu Serif, serif">Button</font>的用方法(按钮Q?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">4</font>Q?font face="DejaVu Serif, serif">Menu</font>的用方法(菜单Q?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">/***</font>我在<font face="DejaVu Serif, serif">Mars</font>操作中所注意到的东西Q?/p> <p style="margin-bottom: 0cm;">Q?font face="DejaVu Serif, serif">1</font>Qؓ所以显C类型文本框中,<font face="DejaVu Serif, serif">setText()</font>Ҏ中最好是?font face="DejaVu Serif, serif">string</font>中徏立键值对q进行引用,q样有助与实现应用简化了各种语言的的译问题。(当然目前不认为写的应用会被翻译,不过好习惯是要提前养成的Q?/p> <p style="margin-bottom: 0cm;">Q?font face="DejaVu Serif, serif">2</font>Q?font face="DejaVu Serif, serif">Mars</font>老师好会善用<font face="DejaVu Serif, serif">Eclipse</font>强大的编辑功能,强大的快捷键比如<font face="DejaVu Serif, serif">Ctrl+Shift+O ; Alt+. ; Ctrl+1</font>要多多用之</p> <p style="margin-bottom: 0cm;">Q?font face="DejaVu Serif, serif">3</font>Q关?font face="DejaVu Serif, serif">OptionsMenu</font>的两个方法:<font face="DejaVu Serif, serif">onCreateOptionsMenus()</font>?font face="DejaVu Serif, serif">OnOptionsMenuSelected()</font></p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">***/</font></p> <p style="margin-bottom: 0cm;"><br /> </p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">01-07-Activity</font>生命周期Q一Q?/p> <p style="margin-bottom: 0cm;">七个生命周期Q?font face="DejaVu Serif, serif"><br /> </font>Q?font face="DejaVu Serif, serif">1</font>Q?font face="DejaVu Serif, serif">onCreate()</font>?font face="DejaVu Serif, serif">Activity</font>W一ơ启动的时候执行;在这里编写实?font face="DejaVu Serif, serif">Activity</font>?font face="DejaVu Serif, serif">layout</font>的代码,q添加对应的监听器?/p> <p style="margin-bottom: 0cm;">Q?font face="DejaVu Serif, serif">2</font>Q?font face="DejaVu Serif, serif">onStart()</font>?font face="DejaVu Serif, serif">Activity</font>能被用户看到的时候执?/p> <p style="margin-bottom: 0cm;">Q?font face="DejaVu Serif, serif">3</font>Q?font face="DejaVu Serif, serif">onResume()</font>?font face="DejaVu Serif, serif">Activity</font>能获得用L点的时候执行(能与用户q行交互的时候)</p> <p style="margin-bottom: 0cm;">Q?font face="DejaVu Serif, serif">4</font>Q?font face="DejaVu Serif, serif">onPause()</font>?font face="DejaVu Serif, serif">Activity</font>当中启动另一?font face="DejaVu Serif, serif">Activity</font>的时候执?/p> <p style="margin-bottom: 0cm;">Q?font face="DejaVu Serif, serif">5</font>Q?font face="DejaVu Serif, serif">onStop()</font>?font face="DejaVu Serif, serif">Activity</font>不能被用L到的时候执行(被另外一?font face="DejaVu Serif, serif">Activity</font>完全覆盖Q?/p> <p style="margin-bottom: 0cm;">Q?font face="DejaVu Serif, serif">6</font>Q?font face="DejaVu Serif, serif">onRestart()</font>在处?font face="DejaVu Serif, serif">stop()</font>状态的<font face="DejaVu Serif, serif">Activity</font>重新启动的时候(区别?font face="DejaVu Serif, serif">onCreate()</font>的初ơ启动)</p> <p style="margin-bottom: 0cm;">Q?font face="DejaVu Serif, serif">7</font>Q?font face="DejaVu Serif, serif">onDestroy()</font>?font face="DejaVu Serif, serif">Activity</font>被销毁的时候(两种情况Q用h调用了<font face="DejaVu Serif, serif">finish()</font>ҎQ或者在pȝ资源不的时候系l自动清理处于后台状态的<font face="DejaVu Serif, serif">Activity</font>Q?/p> <p style="margin-bottom: 0cm;"><br /> </p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">01-08-Activity</font>的生命周期(二)</p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">1</font>Q?font face="DejaVu Serif, serif">Task</font>的基本概?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">2</font>Q?font face="DejaVu Serif, serif">Activity</font>?font face="DejaVu Serif, serif">Task</font>之间的关p?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">3</font>Q对话框风格<font face="DejaVu Serif, serif">Activity</font>的用方?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">/***</font></p> <p style="margin-bottom: 0cm;">Q?font face="DejaVu Serif, serif">1</font>Q?font face="DejaVu Serif, serif">Task is a stack of Activity.</font>所?font face="DejaVu Serif, serif">Task</font>只能q行<font face="DejaVu Serif, serif">push</font>?font face="DejaVu Serif, serif">pop</font>操作Q内部不能进行重新排序?font face="DejaVu Serif, serif">Android</font>昄的始l时<font face="DejaVu Serif, serif">Task</font>最上面?font face="DejaVu Serif, serif">Activity</font>?font face="DejaVu Serif, serif">Task</font>的一个重要意义:?font face="DejaVu Serif, serif">Task</font>中所?font face="DejaVu Serif, serif">Activity</font>成ؓ一个整体,l用戯好的体验?/p> <p style="margin-bottom: 0cm;">Q?font face="DejaVu Serif, serif">2</font>Q如果在调用另一?font face="DejaVu Serif, serif">Activity</font>的时候调用原<font face="DejaVu Serif, serif">Activity</font>?font face="DejaVu Serif, serif">finish()</font>ҎQ原<font face="DejaVu Serif, serif">Activity</font>会被销毁(即不再在栈中Q?/p> <p style="margin-bottom: 0cm;">Q?font face="DejaVu Serif, serif">3</font>Q?font face="DejaVu Serif, serif">Android</font>在系l资源不够用的时候会自动清理一?font face="DejaVu Serif, serif">Activity</font>Q当<font face="DejaVu Serif, serif">Activity</font>处于<font face="DejaVu Serif, serif">onPause()</font>Q?font face="DejaVu Serif, serif">onStop</font>Q?font face="DejaVu Serif, serif">onDestroy()</font>的状态时Q则有可能会?font face="DejaVu Serif, serif">kill</font>?/p> <p style="margin-bottom: 0cm;">Q?font face="DejaVu Serif, serif">4</font>Q一?font face="DejaVu Serif, serif">Activity</font>?font face="DejaVu Serif, serif">AndroidManifest</font>中注册的时候,可以通过讄<font face="DejaVu Serif, serif">theme</font>?font face="DejaVu Serif, serif">theme.dialog</font>的方法显CZؓ对话框风|是不会完全遮挡住原<font face="DejaVu Serif, serif">Activity</font>的那U,在实际手机应用中相当常用Q?font face="DejaVu Serif, serif">***/</font></p> <p style="margin-bottom: 0cm;"><br /> </p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">01-09-Activity</font>布局初步<font face="DejaVu Serif, serif">(</font>一<font face="DejaVu Serif, serif">)</font></p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">1</font>Q?font face="DejaVu Serif, serif">LinearLayout</font>的用方?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">2</font>Q?font face="DejaVu Serif, serif">TableLayout</font>的用方?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">/***</font></p> <p style="margin-bottom: 0cm;">大致介绍了线性和表格两种常用布局和它们在<font face="DejaVu Serif, serif">xml</font>中的一些属性比?font face="DejaVu Serif, serif">gravity,padding,orientation,weight,singleLine</font>{,详细可以参看<font face="DejaVu Serif, serif">documentation</font></p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">***/</font></p> <p style="margin-bottom: 0cm;"><br /> </p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">01-10-Activity</font>布局初步<font face="DejaVu Serif, serif">(</font>?font face="DejaVu Serif, serif">)</font></p> <p style="margin-bottom: 0cm;">大致介绍?font face="DejaVu Serif, serif">Layout</font>的相互嵌套。(怺嵌套能够构造更加复杂和华丽的布局Q?/p> <p style="margin-bottom: 0cm;"><br /> </p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">01-11-Activity</font>的布局初步Q三Q?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">1</font>Q相对布局的基本概?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">2</font>Q相对布局与其他布局的区?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">3</font>Q相对布局的常用属性介l?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">/***</font>相对布局用的是跟U性或表格布局不同的布局方式Q它布局采用控g的相对位|来q行讄。具体参数参?font face="DejaVu Serif, serif">SDK</font>或者视?font face="DejaVu Serif, serif">***/</font></p> <p style="margin-bottom: 0cm;"><br /> </p> <p style="margin-bottom: 0cm;"><br /> </p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">01-12-Android</font>常见控gQ二Q?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">1</font>Q?font face="DejaVu Serif, serif">RadioGroup</font>?font face="DejaVu Serif, serif">RadioButton</font>的用方?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">2</font>Q?font face="DejaVu Serif, serif">CheckBox</font>的用方?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">3</font>Q?font face="DejaVu Serif, serif">Toast</font>的基本用?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">/***</font></p> <p style="margin-bottom: 0cm;">大致介绍了三U控Ӟ</p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">RadioGroup&&RadioButton </font>单选框</p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">CheckBox </font>复选框</p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">toast</font>Q(吐司Q感觉就是小型提C框Q?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">A toast is a view containing a quick little message for the user.</font></p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">***/</font></p> <p style="margin-bottom: 0cm;"><br /> </p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">01-13-</font>常用控gQ三Q?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">1</font>Q?font face="DejaVu Serif, serif">ProgressBar</font>的用方?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">2</font>Q?font face="DejaVu Serif, serif">ListView</font>的用方?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">/***</font></p> <p style="margin-bottom: 0cm;">介绍了进度条和列表视囄实现ҎQ这两个是比较复杂的控g<font face="DejaVu Serif, serif">,</font>其中<font face="DejaVu Serif, serif">ListView</font>涉及<font face="DejaVu Serif, serif">Adaptor</font>Q在使用之前要好好参看视频和<font face="DejaVu Serif, serif">SDK Documentation</font></p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">***/</font></p> <p style="margin-bottom: 0cm;"><br /> </p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">01-14-Handler</font>的用(一Q?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">1</font>Q?font face="DejaVu Serif, serif">Handler</font>的基本概?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">2</font>Q?font face="DejaVu Serif, serif">Handler</font>的基本用方?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">3</font>Q?font face="DejaVu Serif, serif">Handler</font>更新<font face="DejaVu Serif, serif">ProgressBar</font></p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">/***</font></p> <p style="margin-bottom: 0cm;">Q?font face="DejaVu Serif, serif">1</font>Q?font face="DejaVu Serif, serif">A Handler allows you to send and process <code class="western"><a>Message</a></code> and Runnable objects associated with a thread's <code class="western"><a>MessageQueue</a></code>. Each Handler instance is associated with a single thread and that thread's message queue. When you create a new Handler, it is bound to the thread / message queue of the thread that is creating it -- from that point on, it will deliver messages and runnables to that message queue and execute them as they come out of the message queue. </font> </p> <p style="margin-bottom: 0cm;">一?font face="DejaVu Serif, serif">Handler</font>允许你送出或者处?font face="DejaVu Serif, serif">Message</font>和关联着一个线E消息队列的<font face="DejaVu Serif, serif">Runnable</font>对象。每一?font face="DejaVu Serif, serif">Handler</font>实力都联pd一一个线E和它的消息队列。当你创Z?font face="DejaVu Serif, serif">Handler</font>的时候,他必ȝ定到那个创徏它的U程的或者他的消息队列上面——从那之后,他会传递信息和<font face="DejaVu Serif, serif">Runnable</font>到消息队列和在他们从消息对列出来的时候执行他们。(目前我理解成<font face="DejaVu Serif, serif">Handler</font>是一个操作台Q而且只能唯一l定一个线E和它的消息队列的。)</p> <p style="margin-bottom: 0cm;">Q?font face="DejaVu Serif, serif">2</font>Q?font face="DejaVu Serif, serif">Mars</font>老师l出的参考代码时?font face="DejaVu Serif, serif">Handler</font>操作一条进度条Q中间涉及到?font face="DejaVu Serif, serif">Runnable</font>和消息队列的通信问题。通信的时候有<font face="DejaVu Serif, serif">arg1,arg2</font>两个<font face="DejaVu Serif, serif">int</font>cd的变量,可以减少pȝ的消耗?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">***/</font></p> <p style="margin-bottom: 0cm;"><br /> </p> <p style="margin-bottom: 0cm;"><br /> </p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">01-15-Handler</font>的用(二)</p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">1</font>Q?font face="DejaVu Serif, serif">Handler</font>与线E?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">2</font>Q?font face="DejaVu Serif, serif">Bundle</font>的用?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">3</font>Q在新线E当中处理小的的Ҏ</p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">/***</font></p> <p style="margin-bottom: 0cm;">Q?font face="DejaVu Serif, serif">1</font>Q在之前的例子中Q如果直接用<font face="DejaVu Serif, serif">handler.post(Runnable)</font>Ҏ启动<font face="DejaVu Serif, serif">Runnable</font>对象Q?font face="DejaVu Serif, serif">Android</font>默认不会创徏新的U程。而是直接?font face="DejaVu Serif, serif">Runnable</font>?font face="DejaVu Serif, serif">run()</font>Ҏ攑օCU程的之星队列当中去?/p> <p style="margin-bottom: 0cm;">Q?font face="DejaVu Serif, serif">2</font>Q如果想真正实现两个U程的ƈ行运行,<font face="DejaVu Serif, serif">Mars</font>老师演示了两U方法,W一U是?font face="DejaVu Serif, serif">Java</font>中用<font face="DejaVu Serif, serif">Thread t = new Thread(Runnable)</font>?font face="DejaVu Serif, serif">t.start()</font>来启动新的线E。不知道Z什么样的原因(估计是这样做比较消耗内存)Q所?font face="DejaVu Serif, serif">Mars</font>老师推荐的是另外一U方法—?font face="DejaVu Serif, serif">looper</font>Q但一般不会直接创?font face="DejaVu Serif, serif">Looper</font>Q而是使用?font face="DejaVu Serif, serif">HandlerThread(Looper)</font>来创Z个与<font face="DejaVu Serif, serif">Lopper</font>兌?font face="DejaVu Serif, serif">HandlerThread</font>实例Q然后<font face="DejaVu Serif, serif">HandlerThread.start()</font>Q那?font face="DejaVu Serif, serif">Looper</font>启动v来了Q然后?font face="DejaVu Serif, serif">sendToTarget</font>来触?font face="DejaVu Serif, serif">Handler</font>中间?font face="DejaVu Serif, serif">handleMessage</font>Ҏ可以实现线E了。(思\有点乱,具体再看视频吧)</p> <p style="margin-bottom: 0cm;">Q?font face="DejaVu Serif, serif">3</font>Q?font face="DejaVu Serif, serif">Bundle</font>Q目前理解成是一个简化的<font face="DejaVu Serif, serif">map</font>可以了Q简化是?font face="DejaVu Serif, serif">Bundle</font>的键只能是字W串而且对应的g般是<font face="DejaVu Serif, serif">primitive</font>Q?font face="DejaVu Serif, serif">map</font>的键值都?font face="DejaVu Serif, serif">Object</font>Q,常用于传递一捆数据?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">***/</font></p> <p style="margin-bottom: 0cm;"><br /> </p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">01-16-SQLite</font>使用Ҏ</p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">1</font>Q?font face="DejaVu Serif, serif">SQLite</font>介绍</p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">2</font>Q?font face="DejaVu Serif, serif">SQLiteOpenHelper</font>的用?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">3</font>Q?font face="DejaVu Serif, serif">adb</font>讉K<font face="DejaVu Serif, serif">SQLite</font></p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">4</font>Q增Q删Q改Q查</p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">/***</font></p> <p style="margin-bottom: 0cm;">׃本hҎ据库不太了解Q而且暂时也拍不上什么用场,q节视频先蟩q?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">***/</font></p> <p style="margin-bottom: 0cm;"><br /> </p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">01-17-</font>调试E序</p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">1</font>Q?font face="DejaVu Serif, serif">DDSM</font>Q?font face="DejaVu Serif, serif">Dalvik Debug Monitor Service</font>Q的使用</p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">2</font>Q常用程序调试方?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">/***</font></p> <p style="margin-bottom: 0cm;">大致学习了如何利?font face="DejaVu Serif, serif">logcat</font>?font face="DejaVu Serif, serif">DDSM</font>调试E序Q?font face="DejaVu Serif, serif">DDSM</font>视图中可以重启失去链接之后的虚拟机,以及对虚拟机q行数据导入导出工作Q最牛掰的是当虚拟机q接断掉之后可以在这里重?font face="DejaVu Serif, serif">adb</font>来解决问题。利?font face="DejaVu Serif, serif">logcat</font>可以提取应用q行q程中的信息Q根据重要程度分成五个档位而且向下兼容Q。?font face="DejaVu Serif, serif">Android</font>提供?font face="DejaVu Serif, serif">Log.d()</font>Ҏl合适当?font face="DejaVu Serif, serif">filter</font>可以处理条是信息?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">***/</font></p> <img src ="http://www.aygfsteel.com/level0/aggbug/341553.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/level0/" target="_blank">level0</a> 2010-12-26 10:51 <a href="http://www.aygfsteel.com/level0/articles/341553.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>个h关于ActivityList的学习探?/title><link>http://www.aygfsteel.com/level0/articles/341552.html</link><dc:creator>level0</dc:creator><author>level0</author><pubDate>Sun, 26 Dec 2010 02:47:00 GMT</pubDate><guid>http://www.aygfsteel.com/level0/articles/341552.html</guid><wfw:comment>http://www.aygfsteel.com/level0/comments/341552.html</wfw:comment><comments>http://www.aygfsteel.com/level0/articles/341552.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/level0/comments/commentRss/341552.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/level0/services/trackbacks/341552.html</trackback:ping><description><![CDATA[<style type="text/css">p { margin-bottom: 0.21cm; }code.cjk { font-family: "DejaVu Sans",monospace; }code.ctl { font-family: "DejaVu Sans Mono",monospace; }a:link { }</style> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">ListActivity</font>Q?/p> <p style="margin-bottom: 0cm;">一Q相x늮介(译自官Ҏ档的<font face="DejaVu Serif, serif">class overview</font>Q?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">An activity that displays a list of items by binding to a data source such as an array or Cursor, and exposes event handlers when the user selects an item. </font> </p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">ListActivity hosts a ListView object that can be bound to different data sources, typically either an array or a Cursor holding query results. Binding, screen layout, and row layout are discussed in the following sections. </font> </p> <p style="margin-bottom: 0cm;"><font color="#008000"><font face="DejaVu Serif, serif"><span style="background: none repeat scroll 0% 0% transparent;">ListActivity</span></font><span style="background: none repeat scroll 0% 0% transparent;">是一个用于通过l定到诸?font face="DejaVu Serif, serif">array</font></span><font face="DejaVu Serif, serif"></font><span style="background: none repeat scroll 0% 0% transparent;">?font face="DejaVu Serif, serif">Cursor</font></span><font face="DejaVu Serif, serif"></font><span style="background: none repeat scroll 0% 0% transparent;">{?font face="DejaVu Serif, serif">data source</font></span><font face="DejaVu Serif, serif"></font><span style="background: none repeat scroll 0% 0% transparent;">q列一pd<font face="DejaVu Serif, serif">item</font></span><font face="DejaVu Serif, serif"></font><span style="background: none repeat scroll 0% 0% transparent;">Q当用户选中一?font face="DejaVu Serif, serif">item</font></span><font face="DejaVu Serif, serif"></font><span style="background: none repeat scroll 0% 0% transparent;">的时候,会传?font face="DejaVu Serif, serif">event handler</font></span><font face="DejaVu Serif, serif"></font><span style="background: none repeat scroll 0% 0% transparent;">?/span></font></p> <p style="margin-bottom: 0cm;"><font color="#008000"><font face="DejaVu Serif, serif"><span style="background: none repeat scroll 0% 0% transparent;">ListActivity</span></font><span style="background: none repeat scroll 0% 0% transparent;">拥有一个可以绑定到<font face="DejaVu Serif, serif">data source</font></span><font face="DejaVu Serif, serif"></font><span style="background: none repeat scroll 0% 0% transparent;">Q尤其指带有<font face="DejaVu Serif, serif">query result</font></span><font face="DejaVu Serif, serif"></font><span style="background: none repeat scroll 0% 0% transparent;">?font face="DejaVu Serif, serif">array</font></span><font face="DejaVu Serif, serif"></font><span style="background: none repeat scroll 0% 0% transparent;">?font face="DejaVu Serif, serif">Cursor</font></span><font face="DejaVu Serif, serif"></font><span style="background: none repeat scroll 0% 0% transparent;">Q的<font face="DejaVu Serif, serif">ListView</font></span><font face="DejaVu Serif, serif"></font><span style="background: none repeat scroll 0% 0% transparent;">对象? <font face="DejaVu Serif, serif">Binding,screen layout</font></span><font face="DejaVu Serif, serif"></font><span style="background: none repeat scroll 0% 0% transparent;">?font face="DejaVu Serif, serif">row</font></span><font face="DejaVu Serif, serif"></font><span style="background: none repeat scroll 0% 0% transparent;">在下面讨论?/span></font></p> <p style="margin-bottom: 0cm;">Q?font face="DejaVu Serif, serif">1</font>Q?font face="DejaVu Serif, serif">screen layout </font> </p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">ListActivity has a default layout that consists of a single, full-screen list in the center of the screen. However, if you desire, you can customize the screen layout by setting your own view layout with setContentView() in onCreate(). To do this, your own view MUST contain a ListView object with the id "@android:id/list" (or list if it's in code) </font> </p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">Optionally, your custom view can contain another view object of any type to display when the list view is empty. This "empty list" notifier must have an id "android:empty". Note that when an empty view is present, the list view will be hidden when there is no data to display. </font> </p> <p style="margin-bottom: 0cm;"><font color="#008000"><font face="DejaVu Serif, serif">ListActivity</font>有唯一一个充满整?font face="DejaVu Serif, serif">screen</font>q位?font face="DejaVu Serif, serif">screen</font>正中?font face="DejaVu Serif, serif">list</font>的默?font face="DejaVu Serif, serif">layout</font>。当Ӟ如果你想的话Q你可以?font face="DejaVu Serif, serif">onCreate()</font>里面?font face="DejaVu Serif, serif">setContentView()</font>来透过讄自己?font face="DejaVu Serif, serif">layout</font>来定制这?font face="DejaVu Serif, serif">screen layout</font>。如果你要这样做Q你定制?font face="DejaVu Serif, serif">layout</font>里面务必要包含一?font face="DejaVu Serif, serif">ListView</font>?font face="DejaVu Serif, serif">object</font>Q而且它的<font face="DejaVu Serif, serif">id</font>必须?#8220;<font face="DejaVu Serif, serif">@android:id/list”</font>Q括号里面没看懂什么意思)</font></p> <p style="margin-bottom: 0cm;"><font color="#008000">另外Q你定制?font face="DejaVu Serif, serif">view</font>可以包含另外一个Q何种cȝ<font face="DejaVu Serif, serif">view</font>对象Q当<font face="DejaVu Serif, serif">list view</font>为空的时候它会显现出来,cM圎ͼ它的<font face="DejaVu Serif, serif">id</font>必须?#8220;<font face="DejaVu Serif, serif">@id/android:empty”</font>?/font></p> <p style="margin-bottom: 0cm;">Q?font face="DejaVu Serif, serif">2</font>Q?font face="DejaVu Serif, serif">row layout</font>Q?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">You can specify the layout of individual rows in the list. You do this by specifying a layout resource in the ListAdapter object hosted by the activity (the ListAdapter binds the ListView to the data; more on this later). </font> </p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">A ListAdapter constructor takes a parameter that specifies a layout resource for each row. It also has two additional parameters that let you specify which data field to associate with which object in the row layout resource. These two parameters are typically parallel arrays. </font> </p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">Android provides some standard row layout resources. These are in the R.layout class, and have names such as simple_list_item_1, simple_list_item_2, and two_line_list_item. The following layout XML is the source for the resource two_line_list_item, which displays two data fields,one above the other, for each list row. </font> </p> <p style="margin-bottom: 0cm;"><font color="#008000">你可以制?font face="DejaVu Serif, serif">list</font>每一个单独的<font face="DejaVu Serif, serif">row</font>?font face="DejaVu Serif, serif">layout</font>。当你这样做Ӟ你可以通过讄<font face="DejaVu Serif, serif">ListAdapter</font>对象来决定用哪?font face="DejaVu Serif, serif">layout resource</font>。一?font face="DejaVu Serif, serif">ListAdapter</font>?font face="DejaVu Serif, serif">constructor</font>臛_讄一?font face="DejaVu Serif, serif">parameter</font>来设?font face="DejaVu Serif, serif">layout resource</font>。同时它有着两个<font face="DejaVu Serif, serif">additonal parameter</font>让你制定哪些<font face="DejaVu Serif, serif">data field</font>应该对应到哪?font face="DejaVu Serif, serif">layout resource</font>中的对象中去。这两个<font face="DejaVu Serif, serif">parameter</font>通常?font face="DejaVu Serif, serif">parallel array</font>Q我理解成一一对应的两个数l,比如?font face="DejaVu Serif, serif">key-value pair</font>是一U?font face="DejaVu Serif, serif">parallel array</font>Q具体参看下面样例代码中?font face="DejaVu Serif, serif">SimpleAdapter</font>的定义过E,׃个参敎ͼ其中W三个时上面说的哪个讑֮<font face="DejaVu Serif, serif">layout resource</font>的参敎ͼ最后两个就是那?font face="DejaVu Serif, serif">parallel array</font>了)</font></p> <p style="margin-bottom: 0cm;"><font color="#008000"><font face="DejaVu Serif, serif">android</font>提供了一些标准的<font face="DejaVu Serif, serif">row layout resource</font>。他们在<font face="DejaVu Serif, serif">R.layout</font>c里面,比如_</font></p> <p style="margin-bottom: 0cm;"><font color="#008000"><font face="DejaVu Serif, serif">Simple_list_item_1 </font>每项有一?font face="DejaVu Serif, serif">TextView</font></font></p> <p style="margin-bottom: 0cm;"><font color="#008000"><font face="DejaVu Serif, serif">Simple_list_item_2 </font>每项有两?font face="DejaVu Serif, serif">TextView</font></font></p> <p style="margin-bottom: 0cm;"><font color="#008000"><font face="DejaVu Serif, serif">Simple_list_item_checked </font>?font face="DejaVu Serif, serif">CheckView</font>的项</font></p> <p style="margin-bottom: 0cm;"><font color="#008000"><font face="DejaVu Serif, serif">Simple_list_item_multiple_choise </font>每项有一?font face="DejaVu Serif, serif">TextView</font>q可以多?/font></p> <p style="margin-bottom: 0cm;"><font color="#008000"><font face="DejaVu Serif, serif">Simple_list_item_single_choice </font>每项有一?font face="DejaVu Serif, serif">TextView</font>Q但只能q行单选?/font></p> <p style="margin-bottom: 0cm;">Q?font face="DejaVu Serif, serif">3</font>Q?font face="DejaVu Serif, serif">Binding to data</font>Q?/p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">You bind the ListActivity's ListView object to data using a class that implements the <code class="western"><a>ListAdapter</a></code> interface. Android provides two standard list adapters: <code class="western"><a>SimpleAdapter</a></code> for static data (Maps), and <code class="western"><a>SimpleCursorAdapter</a></code> for Cursor query results. </font> </p> <p><font color="#008000">你需要通过一?font face="DejaVu Serif, serif">implement</font>?font face="DejaVu Serif, serif">ListAdapter</font>接口的类来把<font face="DejaVu Serif, serif">ListActivity</font>?font face="DejaVu Serif, serif">ListView object</font>l定?font face="DejaVu Serif, serif">data</font>上?font face="DejaVu Serif, serif">Android</font>提供了两个标准的<font face="DejaVu Serif, serif">list adapters:</font>针对<font face="DejaVu Serif, serif">static data(maps)</font>使用?font face="DejaVu Serif, serif">Simple Adapter</font>和针?font face="DejaVu Serif, serif">Cursor query result</font>使用?font face="DejaVu Serif, serif">SimpleCursorAdapter</font>?/font></p> <p><br /> <br /> </p> <p style="margin-bottom: 0cm;">二,零:</p> <p style="margin-bottom: 0cm;"><font face="DejaVu Serif, serif">android:drawSelectorOnTop </font>默认?font face="DejaVu Serif, serif">false</font>Q而且?font face="DejaVu Serif, serif">true</font>的时候颜色会把选项菜单中的字给盖住。(原文是:<font face="DejaVu Serif, serif">When set to true, the selector will be drawn over the selected item. Otherwise the selector is drawn behind the selected item.</font>Q?/p> <p style="margin-bottom: 0cm;"><br /> </p> <p style="margin-bottom: 0cm;">三,个h的理解和样例代码<font face="DejaVu Serif, serif">:</font></p> <p style="margin-bottom: 0cm;">单来_<font face="DejaVu Serif, serif">ListActivity</font>是一个捆l了<font face="DejaVu Serif, serif">List</font>?font face="DejaVu Serif, serif">Activity</font>Q但是他比普通的<font face="DejaVu Serif, serif">Activity</font>上外加一?font face="DejaVu Serif, serif">List</font>的徏立过E要单得多?/p> <p style="margin-bottom: 0cm;">普通的<font face="DejaVu Serif, serif">Activity</font>要添?font face="DejaVu Serif, serif">List</font>Q首先要?font face="DejaVu Serif, serif">layout</font>文g中定义一?font face="DejaVu Serif, serif">ListView</font>Q但<font face="DejaVu Serif, serif">ListActivity</font>里面则可以连<font face="DejaVu Serif, serif">setContentView()</font>都不用写Q?font face="DejaVu Serif, serif">Android</font>pȝ会自动给你分配一个占据全屏幕?font face="DejaVu Serif, serif">List</font>对象。另外,在设|?font face="DejaVu Serif, serif">ListAdapter</font>的时候,pȝ提供了一些默认的布局Q比?font face="DejaVu Serif, serif">simple_list_item_2</font>{)Q可以省去自定义<font face="DejaVu Serif, serif">List</font>布局的功夫(当然有必要的时候也是可以自定义<font face="DejaVu Serif, serif">List</font>的布局的)?/p> <p style="margin-bottom: 0cm;">M来说Q?font face="DejaVu Serif, serif">ListActivity</font>是Z?font face="DejaVu Serif, serif">List</font>建立q程而提供的一?font face="DejaVu Serif, serif">Activity</font>的子cR?/p> <p style="margin-bottom: 0cm;">下面是我自己试的代码。(没有<font face="DejaVu Serif, serif">layout</font>文g因ؓ用不上~Q?/p> <br /> <div style="background-color: rgb(238, 238, 238); font-size: 13px; border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; width: 98%;"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: rgb(0, 0, 255);">package</span><span style="color: rgb(0, 0, 0);"> level0.test.listActivity;<br /> <br /> </span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> java.util.ArrayList;<br /> </span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> java.util.HashMap;<br /> </span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> java.util.List;<br /> <br /> </span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> android.app.ListActivity;<br /> </span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> android.os.Bundle;<br /> </span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> android.view.View;<br /> </span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> android.widget.ListView;<br /> </span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> android.widget.SimpleAdapter;<br /> </span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> android.widget.Toast;<br /> <br /> </span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);"> ListActivityTest </span><span style="color: rgb(0, 0, 255);">extends</span><span style="color: rgb(0, 0, 0);"> ListActivity {<br />     </span><span style="color: rgb(0, 0, 255);">private</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">static</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">final</span><span style="color: rgb(0, 0, 0);"> String HashMap </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">;<br /> <br />     </span><span style="color: rgb(0, 128, 0);">/**</span><span style="color: rgb(0, 128, 0);"> Called when the activity is first created. </span><span style="color: rgb(0, 128, 0);">*/</span><span style="color: rgb(0, 0, 0);"><br />     @Override<br />     </span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);"> onCreate(Bundle savedInstanceState) {<br />         </span><span style="color: rgb(0, 0, 255);">super</span><span style="color: rgb(0, 0, 0);">.onCreate(savedInstanceState);<br />         </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);"> 使用了ListActivity自带的的布局Q可以注释掉setContentView()<br />         </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);"> setContentView(R.layout.main);<br /> <br />         </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);"> 定义存放列表的数据结?/span><span style="color: rgb(0, 128, 0);"><br /> </span><span style="color: rgb(0, 0, 0);">        List</span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);">HashMap</span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);">String, String</span><span style="color: rgb(0, 0, 0);">>></span><span style="color: rgb(0, 0, 0);"> items </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> ArrayList</span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);">HashMap</span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);">String, String</span><span style="color: rgb(0, 0, 0);">>></span><span style="color: rgb(0, 0, 0);">();<br />         HashMap</span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);">String, String</span><span style="color: rgb(0, 0, 0);">></span><span style="color: rgb(0, 0, 0);"> user1 </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> HashMap</span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);">String, String</span><span style="color: rgb(0, 0, 0);">></span><span style="color: rgb(0, 0, 0);">();<br />         HashMap</span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);">String, String</span><span style="color: rgb(0, 0, 0);">></span><span style="color: rgb(0, 0, 0);"> user2 </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> HashMap</span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);">String, String</span><span style="color: rgb(0, 0, 0);">></span><span style="color: rgb(0, 0, 0);">();<br />         HashMap</span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);">String, String</span><span style="color: rgb(0, 0, 0);">></span><span style="color: rgb(0, 0, 0);"> user3 </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> HashMap</span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(0, 0, 0);">String, String</span><span style="color: rgb(0, 0, 0);">></span><span style="color: rgb(0, 0, 0);">();<br />         </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);"> 为每个数据项填充数据</span><span style="color: rgb(0, 128, 0);"><br /> </span><span style="color: rgb(0, 0, 0);">        user1.put(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">user_name</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">level0</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br />         user1.put(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">user_phone</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">135******</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br />         user2.put(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">user_name</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">lisi</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br />         user2.put(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">user_phone</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">1356*****</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br />         user3.put(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">user_name</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">wangwu</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br />         user3.put(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">user_phone</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">13544****</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br />         </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);"> 把数据项d到列表当?/span><span style="color: rgb(0, 128, 0);"><br /> </span><span style="color: rgb(0, 0, 0);">        items.add(user1);<br />         items.add(user2);<br />         items.add(user3);<br />         </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);"> d一个SimpleAdapter,其中W三个参数直接利用了android中提供的一个显C在一列中昄两个TextView的布局Q第五个参数是android提供的TextView的id</span><span style="color: rgb(0, 128, 0);"><br /> </span><span style="color: rgb(0, 0, 0);">        SimpleAdapter adapter </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> SimpleAdapter(</span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);">, items,<br />                 android.R.layout.simple_list_item_2, </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> String[] {<br />                         </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">user_name</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">user_phone</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> }, </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);">[] {<br />                         android.R.id.text1, android.R.id.text2 });<br />         </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);"> 为ListActivity讄Adapter</span><span style="color: rgb(0, 128, 0);"><br /> </span><span style="color: rgb(0, 0, 0);">        setListAdapter(adapter);<br />     }<br /> <br />     @Override<br />     </span><span style="color: rgb(0, 0, 255);">protected</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);"> onListItemClick(ListView l, View v, </span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> position, </span><span style="color: rgb(0, 0, 255);">long</span><span style="color: rgb(0, 0, 0);"> id) {<br />         </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);"> TODO Auto-generated method stub</span><span style="color: rgb(0, 128, 0);"><br /> </span><span style="color: rgb(0, 0, 0);">        Toast.makeText(</span><span style="color: rgb(0, 0, 255);">this</span><span style="color: rgb(0, 0, 0);">, id </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">((HashMap)getListView().getItemAtPosition(position)).get(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">user_name</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">).toString(), Toast.LENGTH_SHORT).show();<br />         </span><span style="color: rgb(0, 0, 255);">super</span><span style="color: rgb(0, 0, 0);">.onListItemClick(l, v, position, id);<br />     }<br /> <br /> }</span></div> <p style="margin-bottom: 0cm;" align="LEFT"><br /> </p> <p style="margin-bottom: 0cm;" align="LEFT"><font color="#000000"><font face="Monospace"><font size="2">能力有限Q先写到q里了?/font></font></font></p> <p style="margin-bottom: 0cm;" align="LEFT"><font color="#000000"><font face="Monospace"><font size="2">另外可以参看文章Q?/font></font></font></p> <p style="margin-bottom: 0cm;" align="LEFT"><font color="#000000"><font face="Monospace"><font size="2">http://blog.csdn.net/xlfb8057/archive/2008/09/04/2880347.aspx</font></font></font></p> <img src ="http://www.aygfsteel.com/level0/aggbug/341552.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/level0/" target="_blank">level0</a> 2010-12-26 10:47 <a href="http://www.aygfsteel.com/level0/articles/341552.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Android Loghttp://www.aygfsteel.com/level0/articles/341058.htmllevel0level0Sat, 18 Dec 2010 06:45:00 GMThttp://www.aygfsteel.com/level0/articles/341058.htmlhttp://www.aygfsteel.com/level0/comments/341058.htmlhttp://www.aygfsteel.com/level0/articles/341058.html#Feedback0http://www.aygfsteel.com/level0/comments/commentRss/341058.htmlhttp://www.aygfsteel.com/level0/services/trackbacks/341058.htmlp { margin-bottom: 0.21cm; }code.cjk { font-family: "DejaVu Sans",monospace; }code.ctl { font-family: "DejaVu Sans Mono",monospace; }a:link { }strong { font-style: italic; font-weight: normal; }

2010.12.03

@OverrideQ?/font>在子cd现父cȝҎӞ在前一行添?font face="DejaVu Serif, serif">@Override标记是很有好处的Q当敲错Ҏ名的时候,~译器会报错?/p>


2010.12.05

AVD for Android Virtual Device

SDK for Software Development Kit

API for Application Programming Interface

GUI for Graphical User Interface


2010.12.09

一Q关?font face="DejaVu Serif, serif">activity:

1Q属?font face="DejaVu Serif, serif">android.app.Activity?/p>

2Q?font face="DejaVu Serif, serif">An activity is a single, focused thing that the user can do. zd是一个单独的Q能获得焦点的能与用戯行交?font face="DejaVu Serif, serif">(interact)的东ѝ?/p>

3Q?font face="DejaVu Serif, serif">onCreate(Bundle) is where you initialize your activity. Most importantly, here you will usually call setContentView(int) with a layout resource defining your UI, and using findViewById(int) to retrieve the widgets in that UI that you need to interact with programmatically.

其中一个常用(必需Q)的方法是onCreate(Bundle)Q在其中会调用到setContentView(int)链接?font face="DejaVu Serif, serif">res中的layout或者其他资源(xmlQ)。另外,findViewById(int)用于?font face="DejaVu Serif, serif">UI中的lgQ专业名词ؓcomponentQ也可通称?font face="DejaVu Serif, serif">widgetQ,q行建立触发器(监听器?listenerQ等操作?/p>

4Q?font face="DejaVu Serif, serif">To be of use with Context.startActivity(), all activity classes must have a corresponding <activity> declaration in their package's AndroidManifest.xml.建立每个zd之后需要在AndroidManifest.xml中注册才能用?/p>

5Q?font face="DejaVu Serif, serif">onCreateOptionsMenu(Menu menu)

Initialize the contents of the Activity's standard options menu.用于建立标准的选项菜单Q?font face="DejaVu Serif, serif">android上按?font face="DejaVu Serif, serif">menu键进入)public boolean onOptionsItemSelected

This hook is called whenever an item in your options menu is selected.用于q一步徏立选项菜单的内部选项

二,What is the differences and conections among Activity, Intent and View?

1Q?font face="DejaVu Serif, serif">An activity is a single, focused thing that the user can do. zd是一个单独的Q能获得焦点的能与用戯行交?font face="DejaVu Serif, serif">(interact)的东ѝ?/p>

2Q?font face="DejaVu Serif, serif">An intent is an abstract description of an operation to be performed. It can be used with startActivity to launch an Activity.

Intent是一个抽象的描诉Q意囑ց什么事Q目前来说我不太理解q个概念Q,它可以用形如startActivity(new Intent(this, **))的语句来启动一个新?font face="DejaVu Serif, serif">Activity?/p>

3Q?font face="DejaVu Serif, serif">ViewQ?font face="DejaVu Serif, serif">This class represents the basic building block for user interface components. A View occupies a rectangular area on the screen and is responsible for drawing and event handling. View is the base class for widgets, which are used to create interactive UI components (buttons, text fields, etc.)

我暂时的理解?#8220;视图”?font face="DejaVu Serif, serif">View?font face="DejaVu Serif, serif">UI的最基本创徏版块Q占领一个方形区域用于绘制图形和攄事g的句柄——组件的基本c,常用于徏立可交互lgQ按钮,文本域)?/p>

4Q目前关于这三者的关系Q我理解是:application的基本单位应该是Activity——applicationp许多多的彼此独立Activity构成?font face="DejaVu Serif, serif">Activity的一个重要特性是它要跟用户生交互,而交互的关键在于Acitivity里面有许许多多的viewQ?font face="DejaVu Serif, serif">view不仅仅是一个静态的视图Q我们可以在View上注册诸如按钮,对话框等交互lg。在Activity中我们经常利?font face="DejaVu Serif, serif">findViewById来查扑֯应的交互lg(或者说交互lg是view自nQ?font face="DejaVu Serif, serif">)来添?font face="DejaVu Serif, serif">listener.那么Intent又是什么?Intent我翻译成意图Q目前我只感觉它是一个由一?font face="DejaVu Serif, serif">Activity跌{到另一?font face="DejaVu Serif, serif">Activity的媒介——因为有了这样那L“意图”Q所以我们需要从目前?font face="DejaVu Serif, serif">Activity跛_另外一个才能相应那?#8220;意图”——目前我是这L解的Q不q按文档来说Intent有着更加深厚的意义,那个以后遇上再说吧?/p>


三,label?font face="DejaVu Serif, serif">title的差别?

都是?font face="DejaVu Serif, serif">R下的@string里面的条目,目前来说感觉label是一个短标记后面一般不跟其他东西,title下会跟着其他内容Q?font face="DejaVu Serif, serif">textQ?font face="DejaVu Serif, serif">label什么的都可以。)


四,最后要提到的一点,Eclipse的包的自动补全功?/strong>Ctrl+Shift+O。(一定要C阿,相当好用Q?/strong>


2010.12.10

一Q?font face="DejaVu Serif, serif">magin?font face="DejaVu Serif, serif">padding的差别?

对于一?font face="DejaVu Serif, serif">borderQ边框)来说Q?font face="DejaVu Serif, serif">margin是外边距Q?font face="DejaVu Serif, serif">padding是内边距?/font>

2010.11.12

一Q什么是contextQ?/font>

contextQ?/span>Interface to global information about an application environment. This is an abstract class whose implementation is provided by the Android system. It allows access to application-specific resources and classes, as well as up-calls for application-level operations such as launching activities, broadcasting and receiving intents, etc.

contextQ语境?Q是一个关于应用环境的全局信息的接口,?font face="DejaVu Serif, serif">androidpȝ来负责实现。它可以q行启动Activity和接?font face="DejaVu Serif, serif">intents{操作?/font>


?font face="DejaVu Serif, serif">,关于view的一点细?/font>

不要?font face="DejaVu Serif, serif">view的构造函C试图使用view的高度和宽度Q那是因为那时?font face="DejaVu Serif, serif">Androidq不知道视图的大(当时宽度和高度都默认?font face="DejaVu Serif, serif">0Q—?font face="DejaVu Serif, serif">Android在布局阶段才会计算宽度和高度——那是在构造函数被调用之后而Q何对象被l制之前?/font>

在视囄宽度和高度已知后Q会通知onSizeChangedҎQ因而可以在其中引用view的宽度和高度。另一U引用的Ҏ是在诸如onDraw()的方法中?font face="DejaVu Serif, serif">getWidth()?font face="DejaVu Serif, serif">getHeight()获取宽度和高度?/font>


2010.11.14

一Q关?font face="DejaVu Serif, serif">Eclipse的一些常用快捷键

ctrl+shift+o 自动补全包,相当好用

ctrl+1 易提C改成错误的Ҏ

alt+/ 自动补全参数名,cdQ方法名Q巨好用

ctrl+/ l选中范围注释Q再按一ơؓ消除注释

ctrl+o 昄cd前承结?/font>

ctrl+shift+f l选中内容q行自动排版?/font>

二,实现[Android开发视频教?font face="DejaVu Serif, serif">].01_05_Activity?font face="DejaVu Serif, serif">Intent 的代码时遇到的错误:

Q?font face="DejaVu Serif, serif">1Q错误:R.id.one是一?font face="DejaVu Serif, serif">EditTextQ我企图直接?font face="DejaVu Serif, serif">String one = getText(R.id.one).toString()来直接把它的D予给one。结果是弹出异常?/font>

Ҏ办法Q正代码如下:EditText textOne = (EditText)findViewById(R.id.one);String one = textOne.getText().toString();

卛_建立一个名?font face="DejaVu Serif, serif">textOne?font face="DejaVu Serif, serif">EditTextQ然后用getText()Ҏ得到它的内容?/font>

Q?font face="DejaVu Serif, serif">2Q错误:企图直接?font face="DejaVu Serif, serif">setText(answer)Ҏ来直接输?font face="DejaVu Serif, serif">answerQ?font face="DejaVu Serif, serif">ansser是个int变量Q?/font>

Ҏ办法Q代码改写成setText(answer + “”);卛_Q根?font face="DejaVu Serif, serif">Java语法Q?font face="DejaVu Serif, serif">int+Stringcd自动转换?font face="DejaVu Serif, serif">StringcdQ补充一句是setText()里面的内容只能是Stringcd的东西)


2010.11.15

一Q关?font face="DejaVu Serif, serif">BundleQ?/font>

A mapping from String values to various Parcelable types.

一个从字符值到各种可打包类型的映射?/font>

Q目前就?font face="DejaVu Serif, serif">onCreate(Bundle savedInstanceState)看到q,理解成一捆数据么Q)


二,this?font face="DejaVu Serif, serif">super指针用法Q?/font>

this概述Q在生成一个对象的时候,pȝ会自动生成一个指?font color="#800000">对象?font face="DejaVu Serif, serif">this指针Q所?font face="DejaVu Serif, serif">this指针是不会指向静态类的?/font>

用法Q(1Q在Ҏ中存在该对象的同名实例变量,需要用“this.实例变量?#8221;来引用实例变量?/font>

Q?font face="DejaVu Serif, serif">2Q在Ҏ中需要应用到对象自n的时候,? ”cd.this“来进行引用?/font>

Q?font face="DejaVu Serif, serif">3Q可以在构造函C直接?#8220;this(参数?font face="DejaVu Serif, serif">)” 来调用自w构造函敎ͼ有时候可以简化代码?/font>

super概述Q在l承关系中,super指向子类?font color="#800000">父类?/font>

用法Q(1Q在子类中引用父cȝ同名实例变量Ӟ?#8220;super.实例变量?#8221;引用父类的变量?/font>

Q?font face="DejaVu Serif, serif">2Q在子类的构造函C?font face="DejaVu Serif, serif">super.构造函数名()调用父类的构造函数。(只能攑֜构造函数的W一行)

Q?font face="DejaVu Serif, serif">3Q在子类中引用父cȝ同名ҎӞ?#8220;super.Ҏ?font face="DejaVu Serif, serif">(参数?font face="DejaVu Serif, serif">)”引用父类的方法?/font>


三,Eclipse中又两个个好用的快捷键:

F3Q快速定位当前选中的自定义ҎQ自定义变量名的原出处?/font>

F4Q快速展开选中cȝl承层次?/font>



level0 2010-12-18 14:45 发表评论
]]>
վ֩ģ壺 | ػʵ| ʡ| | | ӳ| | ;| | | | ӽ| | ƽ| | | »| ƽ| | ɽ| ½| | Ȫ| ƺ| ũ| | ˮ| | н| Ǭ| ƽ| | | | ɽ| | | | ӳ| ɽ| |