<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet href='http://feed.feedsky.com/styles/temp01.xsl' type='text/xsl' ?><!--这是一个由Feedsy提供技术支持的Feed，为了提高读者阅读的体验，以及满足用户美化自己Feed的需要，我们设计了多种精美的Feed模板，提供给大家选择，所有最终呈现出来的样式，皆由用户自愿选择使用，未经许可，任何团体和个人，请不要擅自修改样式或者盗用，这是对于用户选择权的尊重。--><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:fs="http://www.feedsky.com/namespace/feed" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link href="http://feed.feedsky.com/chendw" type="application/rss+xml" rel="self"></atom:link><fs:self_link href="http://feed.feedsky.com/chendw" type="application/rss+xml"></fs:self_link><lastBuildDate>Wed, 22 Feb 2012 02:14:04 GMT</lastBuildDate><title>寂 寞 喝 口 水</title><description>技术源于经验，经验来源于积累！</description><link>http://www.chendw.cn</link><sy:updatePeriod>hourly</sy:updatePeriod><sy:updateFrequency>1</sy:updateFrequency><language>en</language><pubDate>Wed, 22 Feb 2012 02:15:25 GMT</pubDate><item><title>解决Eclipse3.6中Android 代码自动补全卡死的问题</title><link>http://www.chendw.cn/problemsolving/645.html</link><content:encoded>&lt;p&gt;1.下载Eclipse plugin 补丁文件 org.eclipse.jdt.core_3.6.1.v_A68_R36x.jar:(下载地址&lt;a href=&quot;http://115.com/file/dpyccotd&quot;&gt;http://115.com/file/dpyccotd&lt;/a&gt;)&lt;br /&gt;
2.将解压缩后的jar包 放到Eclipse的目录中的Plugin下面,&lt;br /&gt;
3.Android开发时代码提示卡死的问题应该已经解决.如果Java代码开发比较忙,参考以下步骤&lt;br /&gt;
4. 找到你的JDK安装目录下的src.zip文件；&lt;br /&gt;
5. 打开eclipse: Window菜单-&gt;Preference-&gt;Java-&gt;Installed JREs；&lt;br /&gt;
6. 在列表中选择你eclipse正在使用的JRE，然后Edit；&lt;br /&gt;
7. 选择rt.jar，然后点击&quot;Source Attachment&quot;按钮，弹出对话框后选择&quot;External File&quot;，然后把你的JDK安装目录下的src.zip文件与rt.jar关联上。&lt;br /&gt;
===================================================================================&lt;br /&gt;
网上说3.6版换回3.5即可，未测试，不过大部分人反映可解决卡顿问题。&lt;/p&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/608513707/chendw/feedsky/s.gif?r=http://www.chendw.cn/problemsolving/645.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</content:encoded><wfw:commentRss>http://www.chendw.cn/problemsolving/645.html/feed</wfw:commentRss><slash:comments>0</slash:comments><description>1.下载Eclipse plugin 补丁文件 org.eclipse.jdt.core_3.6.1.v_A68_R36x.jar:(下载地址http://115.com/file/dpyccotd) 2.将解压缩后的jar包 放到Eclipse的目录中的Plugin下面, 3.Android开发时代码提示卡死的问题应该已经解决.如果Java代码开发比较忙,参考以下步骤 4. 找到你的JDK安装目录下的src.zip文件； 5. 打开eclipse: Window菜单-&gt;Preference-&gt;Java-&gt;Installed JREs； 6. 在列表中选择你eclipse正在使用的JRE，然后Edit； 7. 选择rt.jar，然后点击&quot;Source Attachment&quot;按钮，弹出对话框后选择&quot;External File&quot;，然后把你的JDK安装目录下的src.zip文件与rt.jar关联上。 =================================================================================== 网上说3.6版换回3.5即可，未测试，不过大部分人反映可解决卡顿问题。&lt;img src=&quot;http://www1.feedsky.com/t1/608513707/chendw/feedsky/s.gif?r=http://www.chendw.cn/problemsolving/645.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><category>问题解决</category><category>Android</category><category>Eclipse</category><pubDate>Wed, 22 Feb 2012 10:14:04 +0800</pubDate><author>随风散忆</author><comments>http://www.chendw.cn/problemsolving/645.html#comments</comments><guid isPermaLink="false">http://www.chendw.cn/?p=645</guid><dc:creator>随风散忆</dc:creator><fs:srclink>http://www.chendw.cn/problemsolving/645.html</fs:srclink><fs:srcfeed>http://www.chendw.cn/feed</fs:srcfeed><fs:itemid>feedsky/chendw/~8582565/608513707/6687410</fs:itemid></item><item><title>svn: Can’t open file ‘***/txn-current-lock’: Permission denied解决</title><link>http://www.chendw.cn/problemsolving/639.html</link><content:encoded>&lt;p&gt;主要有两种可能&lt;/p&gt;
&lt;p&gt;1、目录权限问题：&lt;/p&gt;
&lt;p&gt;chmod -R 775 /opt/svn&lt;/p&gt;
&lt;p&gt;尝试提交svn，如果可以则结束，如果不行则继续往下&lt;/p&gt;
&lt;p&gt;2、如果是linux的服务器那么需要关闭SElinux，命令如下：&lt;/p&gt;
&lt;p&gt;临时关闭下次重启后失效：setenforce 0&lt;/p&gt;
&lt;p&gt;永久关闭：vi /etc/sysconfig/selinux #配置SELINUX=disable&lt;/p&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/608513708/chendw/feedsky/s.gif?r=http://www.chendw.cn/problemsolving/639.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</content:encoded><wfw:commentRss>http://www.chendw.cn/problemsolving/639.html/feed</wfw:commentRss><slash:comments>0</slash:comments><description>主要有两种可能 1、目录权限问题： chmod -R 775 /opt/svn 尝试提交svn，如果可以则结束，如果不行则继续往下 2、如果是linux的服务器那么需要关闭SElinux，命令如下： 临时关闭下次重启后失效：setenforce 0 永久关闭：vi /etc/sysconfig/selinux #配置SELINUX=disable&lt;img src=&quot;http://www1.feedsky.com/t1/608513708/chendw/feedsky/s.gif?r=http://www.chendw.cn/problemsolving/639.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><category>Linux</category><category>问题解决</category><category>Svn</category><pubDate>Mon, 13 Feb 2012 16:52:28 +0800</pubDate><author>随风散忆</author><comments>http://www.chendw.cn/problemsolving/639.html#comments</comments><guid isPermaLink="false">http://www.chendw.cn/?p=639</guid><dc:creator>随风散忆</dc:creator><fs:srclink>http://www.chendw.cn/problemsolving/639.html</fs:srclink><fs:srcfeed>http://www.chendw.cn/feed</fs:srcfeed><fs:itemid>feedsky/chendw/~8582565/608513708/6687410</fs:itemid></item><item><title>一次修复磁盘出错导致无法启动【转】</title><link>http://www.chendw.cn/problemsolving/634.html</link><content:encoded>&lt;p&gt;重启机器，结果在启动到这里的时候出错了：&lt;br /&gt;
Checking filesystems /dev/VolGroup00/LogVol00 contains a file system with errors, check forced.&lt;br /&gt;
/dev/VolGroup00/LogVol00:&lt;br /&gt;
Inodes that were part of a corrupted orphan linked list found&lt;br /&gt;
/dev/VolGroup00/LogVol00:&lt;br /&gt;
UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.&lt;br /&gt;
(i.e., without -a or -p options)                              [FAILED]&lt;/p&gt;
&lt;p&gt;输入root密码登陆之后尝试以下命令修复重启成功：fsck.ext3 /dev/VolGroup00/LogVol00&lt;/p&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/608513709/chendw/feedsky/s.gif?r=http://www.chendw.cn/problemsolving/634.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</content:encoded><wfw:commentRss>http://www.chendw.cn/problemsolving/634.html/feed</wfw:commentRss><slash:comments>3</slash:comments><description>重启机器，结果在启动到这里的时候出错了： Checking filesystems /dev/VolGroup00/LogVol00 contains a file system with errors, check forced. /dev/VolGroup00/LogVol00: Inodes that were part of a corrupted orphan linked list found /dev/VolGroup00/LogVol00: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY. (i.e., without -a or -p options)                              [FAILED] 输入root密码登陆之后尝试以下命令修复重启成功：fsck.ext3 /dev/VolGroup00/LogVol00&lt;img src=&quot;http://www1.feedsky.com/t1/608513709/chendw/feedsky/s.gif?r=http://www.chendw.cn/problemsolving/634.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><category>Linux</category><category>问题解决</category><category>CentOS</category><pubDate>Thu, 19 Jan 2012 17:10:41 +0800</pubDate><author>随风散忆</author><comments>http://www.chendw.cn/problemsolving/634.html#comments</comments><guid isPermaLink="false">http://www.chendw.cn/?p=634</guid><dc:creator>随风散忆</dc:creator><fs:srclink>http://www.chendw.cn/problemsolving/634.html</fs:srclink><fs:srcfeed>http://www.chendw.cn/feed</fs:srcfeed><fs:itemid>feedsky/chendw/~8582565/608513709/6687410</fs:itemid></item><item><title>Crontab表达式</title><link>http://www.chendw.cn/soft/626.html</link><content:encoded>&lt;p&gt;语法介绍&lt;/p&gt;
&lt;p&gt;使用权限: root用户和crontab文件的所有者&lt;/p&gt;
&lt;p&gt;crontab格式语法:&lt;/p&gt;
&lt;p&gt;crontab [-e [UserName]|-l [UserName]|-r [UserName]|-v [UserName]|File ]&lt;/p&gt;
&lt;p&gt;说明:&lt;/p&gt;
&lt;p&gt;crontab 是用来让使用者在固定时间或固定间隔执行程序之用，换句话说，也就是类似使用者的时程表。-u user 是指设定指定 user 的时程表，这个前提是你必须要有其权限(比如说是 root)才能够指定他人的时程表。如果不使用 -u user 的话，就是表示设定自己的时程表。&lt;/p&gt;
&lt;p&gt;参数:&lt;/p&gt;
&lt;p&gt;-e [UserName]: 执行文字编辑器来设定时程表，内定的文字编辑器是 VI，如果你想用别的文字编辑器，则请先设定 VISUAL 环境变数来指定使用那个文字编辑器(比如说 setenv VISUAL joe)&lt;/p&gt;
&lt;p&gt;-r [UserName]: 删除目前的时程表&lt;/p&gt;
&lt;p&gt;-l [UserName]: 列出目前的时程表&lt;/p&gt;
&lt;p&gt;-v [UserName]:列出用户cron作业的状态&lt;/p&gt;
&lt;p&gt;时程表的格式如下:&lt;/p&gt;
&lt;p&gt;f1 f2 f3 f4 f5 program&lt;/p&gt;
&lt;p&gt;其中 f1 是表示分钟，f2 表示小时，f3 表示一个月份中的第几日，f4 表示月份，f5 表示一个星期中的第几天。program 表示要执行的程式。&lt;/p&gt;
&lt;p&gt;当 f1 为 * 时表示每分钟都要执行 program，f2 为 * 时表示每小时都要执行程式，其余类推&lt;/p&gt;
&lt;p&gt;当 f1 为 a-b 时表示从第 a 分钟到第 b 分钟这段时间内要执行，f2 为 a-b 时表示从第 a 到第 b 小时都要执行，其余类推&lt;/p&gt;
&lt;p&gt;当 f1 为 */n 时表示每 n 分钟个时间间隔执行一次，f2 为 */n 表示每 n 小时个时间间隔执行一次，其余类推&lt;/p&gt;
&lt;p&gt;当 f1 为 a, b, c,... 时表示第 a, b, c,... 分钟要执行，f2 为 a, b, c,... 时表示第 a, b, c...个小时要执行，其余类推&lt;/p&gt;
&lt;p&gt;使用者也可以将所有的设定先存放在档案 file 中，用 crontab file 的方式来设定时程表。&lt;/p&gt;
&lt;p&gt;由于unix版本不一样，所以部分语法有差别，例如在hp unix aix 中设定间隔执行如果采用*/n 方式将出现语法错误，在这类unix中 ，间隔执行只能以列举方式，详请见例子。&lt;/p&gt;
&lt;p&gt;常用表达式：&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;每晚21：30分执行一次：30 21 * * *&lt;/p&gt;
&lt;p&gt;每分钟执行一次：*/1 * * * *&lt;/p&gt;
&lt;p&gt;每10秒执行一次：*:10 * * * *&lt;/p&gt;
&lt;p&gt;每月1、10、22日的4 : 45执行一次：45 4 1,10,22 * *&lt;/p&gt;
&lt;p&gt;每天18 : 00至23 : 00之间每隔30分钟执行：0,30 18-23 * * *&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;备注：当程式在你所指定的时间执行后，系统会寄一封信给你，显示该程式执行的内容，若是你不希望收到这样的信，请在每一行空一格之后加上 &amp;gt; /dev/null 2&amp;gt;&amp;amp;1 即可。&lt;/p&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/608513710/chendw/feedsky/s.gif?r=http://www.chendw.cn/soft/626.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</content:encoded><wfw:commentRss>http://www.chendw.cn/soft/626.html/feed</wfw:commentRss><slash:comments>0</slash:comments><description>语法介绍 使用权限: root用户和crontab文件的所有者 crontab格式语法: crontab [-e [UserName]&amp;#124;-l [UserName]&amp;#124;-r [UserName]&amp;#124;-v [UserName]&amp;#124;File ] 说明: crontab 是用来让使用者在固定时间或固定间隔执行程序之用，换句话说，也就是类似使用者的时程表。-u user 是指设定指定 user 的时程表，这个前提是你必须要有其权限(比如说是 root)才能够指定他人的时程表。如果不使用 -u user 的话，就是表示设定自己的时程表。 参数: -e [UserName]: 执行文字编辑器来设定时程表，内定的文字编辑器是 VI，如果你想用别的文字编辑器，则请先设定 VISUAL 环境变数来指定使用那个文字编辑器(比如说 setenv VISUAL joe) -r [UserName]: 删除目前的时程表 -l [UserName]: 列出目前的时程表 -v [UserName]:列出用户cron作业的状态 时程表的格式如下: f1 f2 f3 f4 f5 program 其中 f1 是表示分钟，f2 表示小时，f3 表示一个月份中的第几日，f4 表示月份，f5 表示一个星期中的第几天。program 表示要执行的程式。 [...]&lt;img src=&quot;http://www1.feedsky.com/t1/608513710/chendw/feedsky/s.gif?r=http://www.chendw.cn/soft/626.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><category>Linux</category><category>资源软件</category><pubDate>Fri, 30 Dec 2011 13:23:22 +0800</pubDate><author>随风散忆</author><comments>http://www.chendw.cn/soft/626.html#comments</comments><guid isPermaLink="false">http://www.chendw.cn/?p=626</guid><dc:creator>随风散忆</dc:creator><fs:srclink>http://www.chendw.cn/soft/626.html</fs:srclink><fs:srcfeed>http://www.chendw.cn/feed</fs:srcfeed><fs:itemid>feedsky/chendw/~8582565/608513710/6687410</fs:itemid></item><item><title>Linux下Oracle归档日志自动清理脚本（sh）</title><link>http://www.chendw.cn/original/622.html</link><content:encoded>&lt;p&gt;可以将以下代码保存为.sh文件，并放到crontab里就可以实现自动清理。&lt;/p&gt;
&lt;div class=&quot;dp-highlighter&quot;&gt;
&lt;div class=&quot;bar&quot;&gt;&lt;/div&gt;
&lt;ol class=&quot;dp-py&quot;&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;&lt;span class=&quot;comment&quot;&gt;#!/bin/sh &lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;export BACK_DATE=`date +%Y%m%d`   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;export BACKUP_PATH=/home/oracle/dbbak   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;echo `mkdir -p ${BACKUP_PATH}/archivelog/${BACK_DATE}`   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;rman msglog=$BACKUP_PATH/archivelog/${BACK_DATE}/arch_0_$BACK_DATE.log &amp;lt;&amp;lt; EOF   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;connect target /;   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;delete expired archivelog all;   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;delete noprompt archivelog until &lt;/span&gt;&lt;span class=&quot;commonlibs&quot;&gt;time&lt;/span&gt;&lt;span&gt; 'sysdate - 1' ;   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;exit   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;EOF   &lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/608513711/chendw/feedsky/s.gif?r=http://www.chendw.cn/original/622.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</content:encoded><wfw:commentRss>http://www.chendw.cn/original/622.html/feed</wfw:commentRss><slash:comments>0</slash:comments><description>可以将以下代码保存为.sh文件，并放到crontab里就可以实现自动清理。 #!/bin/sh    export BACK_DATE=`date +%Y%m%d`    export BACKUP_PATH=/home/oracle/dbbak    echo `mkdir -p ${BACKUP_PATH}/archivelog/${BACK_DATE}`    rman msglog=$BACKUP_PATH/archivelog/${BACK_DATE}/arch_0_$BACK_DATE.log &amp;#60;&amp;#60; EOF    connect target /;    delete expired archivelog all;    delete noprompt archivelog until time 'sysdate - 1' ;    exit    EOF   &lt;img src=&quot;http://www1.feedsky.com/t1/608513711/chendw/feedsky/s.gif?r=http://www.chendw.cn/original/622.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><category>Linux</category><category>Oracle</category><category>本站原创</category><pubDate>Tue, 27 Dec 2011 15:58:37 +0800</pubDate><author>随风散忆</author><comments>http://www.chendw.cn/original/622.html#comments</comments><guid isPermaLink="false">http://www.chendw.cn/?p=622</guid><dc:creator>随风散忆</dc:creator><fs:srclink>http://www.chendw.cn/original/622.html</fs:srclink><fs:srcfeed>http://www.chendw.cn/feed</fs:srcfeed><fs:itemid>feedsky/chendw/~8582565/608513711/6687410</fs:itemid></item><item><title>Linux使用lftp进行文件夹同步</title><link>http://www.chendw.cn/programming/617.html</link><content:encoded>&lt;p&gt;今天遇到个需求，需要将正式环境的备份的数据库文件同步到备用服务器上，看了下lftp的命令可以很好的实现文件夹同步的功能。&lt;/p&gt;
&lt;p&gt;先来熟悉下 了lftp 的基本用法，如果 ftp 服务器是匿名，只要：&lt;/p&gt;
&lt;p&gt;lftp ftpsite&lt;/p&gt;
&lt;p&gt;就可以登录进服务器，如果需要用户名和密码，就要像下面的样子：&lt;/p&gt;
&lt;p&gt;lftp -u username,password ftpsite&lt;/p&gt;
&lt;p&gt;mirror 需要备份的目录 保存备份计算机的本地目录&lt;/p&gt;
&lt;p&gt;例如 mirror /work save/backup，这样 lftp 就会帮你自动同步目录下的所有文件。你也可以给 mirror 命令传入参数，控制同步的行为：&lt;/p&gt;
&lt;p&gt;--delete: 如果远程目录下已经没有某个文件，而本地有，则删除这个文件。&lt;/p&gt;
&lt;p&gt;--only-newer: 只下载新的文件。&lt;/p&gt;
&lt;p&gt;--exculde: 不包含某个目录。&lt;/p&gt;
&lt;p&gt;--verbose: 详细输出。&lt;/p&gt;
&lt;p&gt;举例：&lt;/p&gt;
&lt;p&gt;mirror --delete --only-newer --verbose /work backup/&lt;/p&gt;
&lt;p&gt;自动备份远处电脑的 work文件夹，到本地当前目录的 backup文件夹下，并且删除已经不存在的文件，并且只下载最新的文件，再给出详细的输出。你也可以用 lftp 的 -e 选项，把命令直接接在 lftp 之后：&lt;/p&gt;
&lt;p&gt;lftp -u username,password -e&quot;mirror --delete --only-newer --verbose /work backup/&quot; ftpsite&lt;/p&gt;
&lt;p&gt;也可以用 at 选项指定备份的时间：&lt;/p&gt;
&lt;p&gt;lftp at 00:00 -u username,password -e&quot;mirror --delete --only-newer --verbose /work backup/&quot; ftpsite&lt;/p&gt;
&lt;p&gt;这样每天夜里 12 点就会执行备份任务。&lt;/p&gt;
&lt;p&gt;那么，如何恢复备份呢，很简单，只需要在 mirror 命令中加入 --reverse 选项：&lt;/p&gt;
&lt;p&gt;mirror --reverse --delete --only-newer --verbose /work backup/&lt;/p&gt;
&lt;p&gt;这样 lftp 就会将备份上传到 ftp 服务器上了。&lt;/p&gt;
&lt;p&gt;同时还可以写成bak.sh脚本放到crontab里定时执行&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div class=&quot;dp-highlighter&quot;&gt;
&lt;div class=&quot;bar&quot;&gt;&lt;/div&gt;
&lt;ol class=&quot;dp-perl&quot;&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;&lt;span class=&quot;comment&quot;&gt;#!/bin/sh &lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;HOST=&lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;192.168.1.2&quot;&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;USER=&lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;oracle&quot;&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;PASS=&lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;123456&quot;&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;PORT=&lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;22&quot;&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;    &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;cd /home/oracle/dbbak   &lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;##下载备份文件存放的本地目录 &lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;echo &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;Starting to sftp&quot;&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;    &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;lftp -p ${PORT} -u ${USER},${PASS} sftp://${HOST} &amp;gt;&amp;gt; /home/oracle/debug.&lt;/span&gt;&lt;span class=&quot;func&quot;&gt;log&lt;/span&gt;&lt;span&gt; 2&amp;gt;&amp;amp;1 &amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;func&quot;&gt;EOF&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;mirror --&lt;/span&gt;&lt;span class=&quot;func&quot;&gt;delete&lt;/span&gt;&lt;span&gt; --only-newer --verbose /home/oracle/dbbak /home/oracle/dbbak   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;bye   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;func&quot;&gt;EOF&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;echo &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;done&quot;&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/608513712/chendw/feedsky/s.gif?r=http://www.chendw.cn/programming/617.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</content:encoded><wfw:commentRss>http://www.chendw.cn/programming/617.html/feed</wfw:commentRss><slash:comments>0</slash:comments><description>今天遇到个需求，需要将正式环境的备份的数据库文件同步到备用服务器上，看了下lftp的命令可以很好的实现文件夹同步的功能。 先来熟悉下 了lftp 的基本用法，如果 ftp 服务器是匿名，只要： lftp ftpsite 就可以登录进服务器，如果需要用户名和密码，就要像下面的样子： lftp -u username,password ftpsite mirror 需要备份的目录 保存备份计算机的本地目录 例如 mirror /work save/backup，这样 lftp 就会帮你自动同步目录下的所有文件。你也可以给 mirror 命令传入参数，控制同步的行为： --delete: 如果远程目录下已经没有某个文件，而本地有，则删除这个文件。 --only-newer: 只下载新的文件。 --exculde: 不包含某个目录。 --verbose: 详细输出。 举例： mirror --delete --only-newer --verbose /work backup/ 自动备份远处电脑的 work文件夹，到本地当前目录的 backup文件夹下，并且删除已经不存在的文件，并且只下载最新的文件，再给出详细的输出。你也可以用 lftp 的 -e 选项，把命令直接接在 lftp 之后： lftp -u username,password -e&quot;mirror --delete --only-newer --verbose [...]&lt;img src=&quot;http://www1.feedsky.com/t1/608513712/chendw/feedsky/s.gif?r=http://www.chendw.cn/programming/617.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><category>Linux</category><category>编程技术</category><category>备份</category><category>lftp</category><pubDate>Mon, 26 Dec 2011 10:42:52 +0800</pubDate><author>随风散忆</author><comments>http://www.chendw.cn/programming/617.html#comments</comments><guid isPermaLink="false">http://www.chendw.cn/?p=617</guid><dc:creator>随风散忆</dc:creator><fs:srclink>http://www.chendw.cn/programming/617.html</fs:srclink><fs:srcfeed>http://www.chendw.cn/feed</fs:srcfeed><fs:itemid>feedsky/chendw/~8582565/608513712/6687410</fs:itemid></item><item><title>Android里string.xml使用html标签的方法</title><link>http://www.chendw.cn/programming/606.html</link><content:encoded>&lt;div&gt;方法1、使用 CDATA（推荐）&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&amp;lt;string name=&quot;demoStr&quot;&amp;gt;&amp;lt;Data&amp;gt;&amp;lt;![CDATA[ &amp;lt;b&amp;gt;ABC&amp;lt;/b&amp;gt; ]]&amp;gt; &amp;lt;/Data&amp;gt;&amp;lt;/string&amp;gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;方法2、转义HTML标签&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&amp;lt;string name=&quot;myHeadStr&quot;&amp;gt;&amp;amp;lt;b&amp;gt;&amp;amp;lt;u&amp;gt;bold, underline &amp;amp;lt;/u&amp;gt;&amp;amp;lt;/b&amp;gt;&amp;lt;/string&amp;gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;在程序里引用：&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;Html.fromHtml(getResources().getString(R.string.myHeadStr));&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;效果图&lt;/div&gt;
&lt;div&gt;
&lt;div class=&quot;mceTemp&quot;&gt;
&lt;dl id=&quot;attachment_607&quot; class=&quot;wp-caption alignnone&quot; style=&quot;width: 397px;&quot;&gt;
&lt;dt class=&quot;wp-caption-dt&quot;&gt;&lt;/dt&gt;
&lt;dd class=&quot;wp-caption-dd&quot;&gt;android string html标签用法&lt;/dd&gt;
&lt;/dl&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;&lt;a href=&quot;http://www.chendw.cn/wp-content/uploads/2011/12/20111221160111.png&quot; class=&quot;highslide-image&quot; onclick=&quot;return hs.expand(this);&quot;&gt;&lt;img class=&quot;alignnone size-full wp-image-611&quot; title=&quot;20111221160111&quot; src=&quot;http://www.chendw.cn/wp-content/uploads/2011/12/20111221160111.png&quot; alt=&quot;&quot; width=&quot;387&quot; height=&quot;239&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;string.xml代码&lt;/div&gt;
&lt;div class=&quot;dp-highlighter&quot;&gt;
&lt;div class=&quot;bar&quot;&gt;
&lt;div class=&quot;tools&quot;&gt;&lt;strong style=&quot;color: #000;&quot;&gt;Code&lt;/strong&gt;   &lt;a onclick=&quot;dp.sh.Toolbar.Command('ViewSource',this);return false;&quot; href=&quot;file:///D:/Program%20Files/CodeRender(Unmi)/CodeRender.hta#&quot;&gt;View&lt;/a&gt;&lt;a onclick=&quot;dp.sh.Toolbar.Command('CopyToClipboard',this);return false;&quot; href=&quot;file:///D:/Program%20Files/CodeRender(Unmi)/CodeRender.hta#&quot;&gt;Copy&lt;/a&gt;&lt;a onclick=&quot;dp.sh.Toolbar.Command('PrintSource',this);return false;&quot; href=&quot;file:///D:/Program%20Files/CodeRender(Unmi)/CodeRender.hta#&quot;&gt;Print&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;ol class=&quot;dp-xml&quot;&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;&lt;span class=&quot;tag&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;tag-name&quot;&gt;string&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;attribute&quot;&gt;name&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;attribute-value&quot;&gt;&quot;test&quot;&lt;/span&gt;&lt;span class=&quot;tag&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;tag&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;tag-name&quot;&gt;Data&lt;/span&gt;&lt;span class=&quot;tag&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;cdata&quot;&gt;&amp;lt;![CDATA[ &amp;lt;b&amp;gt;&amp;lt;font color=&quot;#ff0000&quot;&amp;gt;ABC&amp;lt;/font&amp;gt;&amp;lt;/b&amp;gt; ]]&amp;gt;&lt;/span&gt;&lt;span class=&quot;tag&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;tag-name&quot;&gt;Data&lt;/span&gt;&lt;span class=&quot;tag&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;tag&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;tag-name&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;tag&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;p&gt;java代码：&lt;/p&gt;
&lt;div class=&quot;dp-highlighter&quot;&gt;
&lt;div class=&quot;bar&quot;&gt;
&lt;div class=&quot;tools&quot;&gt;&lt;strong style=&quot;color: #000;&quot;&gt;Code&lt;/strong&gt;   &lt;a onclick=&quot;dp.sh.Toolbar.Command('ViewSource',this);return false;&quot; href=&quot;file:///D:/Program%20Files/CodeRender(Unmi)/CodeRender.hta#&quot;&gt;View&lt;/a&gt;&lt;a onclick=&quot;dp.sh.Toolbar.Command('CopyToClipboard',this);return false;&quot; href=&quot;file:///D:/Program%20Files/CodeRender(Unmi)/CodeRender.hta#&quot;&gt;Copy&lt;/a&gt;&lt;a onclick=&quot;dp.sh.Toolbar.Command('PrintSource',this);return false;&quot; href=&quot;file:///D:/Program%20Files/CodeRender(Unmi)/CodeRender.hta#&quot;&gt;Print&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;ol class=&quot;dp-j&quot;&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;&lt;span class=&quot;keyword&quot;&gt;import&lt;/span&gt;&lt;span&gt; android.app.Activity;   &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;keyword&quot;&gt;import&lt;/span&gt;&lt;span&gt; android.app.AlertDialog;   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span class=&quot;keyword&quot;&gt;import&lt;/span&gt;&lt;span&gt; android.content.DialogInterface;   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;keyword&quot;&gt;import&lt;/span&gt;&lt;span&gt; android.os.Bundle;   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span class=&quot;keyword&quot;&gt;import&lt;/span&gt;&lt;span&gt; android.text.Html;   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span class=&quot;keyword&quot;&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;class&lt;/span&gt;&lt;span&gt; testActivity &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;extends&lt;/span&gt;&lt;span&gt; Activity {   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;void&lt;/span&gt;&lt;span&gt; onCreate(Bundle savedInstanceState) {   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;super&lt;/span&gt;&lt;span&gt;.onCreate(savedInstanceState);   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        AlertDialog.Builder dialog = &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;new&lt;/span&gt;&lt;span&gt; AlertDialog.Builder(testActivity.&lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;this&lt;/span&gt;&lt;span&gt;);   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        dialog.setTitle(&lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;测试HTML标签&quot;&lt;/span&gt;&lt;span&gt;).setMessage(Html.fromHtml(getString(R.string.test))).setPositiveButton(getString(R.string.btn_confirm), &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;new&lt;/span&gt;&lt;span&gt; DialogInterface.OnClickListener() {   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;            &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;void&lt;/span&gt;&lt;span&gt; onClick(DialogInterface dialog, &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;int&lt;/span&gt;&lt;span&gt; which) {   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;            }   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        }).create().show();   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;    }   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;}   &lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/608513713/chendw/feedsky/s.gif?r=http://www.chendw.cn/programming/606.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</content:encoded><wfw:commentRss>http://www.chendw.cn/programming/606.html/feed</wfw:commentRss><slash:comments>0</slash:comments><description>方法1、使用 CDATA（推荐） &amp;#60;string name=&quot;demoStr&quot;&amp;#62;&amp;#60;Data&amp;#62;&amp;#60;![CDATA[ &amp;#60;b&amp;#62;ABC&amp;#60;/b&amp;#62; ]]&amp;#62; &amp;#60;/Data&amp;#62;&amp;#60;/string&amp;#62; 方法2、转义HTML标签 &amp;#60;string name=&quot;myHeadStr&quot;&amp;#62;&amp;#38;lt;b&amp;#62;&amp;#38;lt;u&amp;#62;bold, underline &amp;#38;lt;/u&amp;#62;&amp;#38;lt;/b&amp;#62;&amp;#60;/string&amp;#62; 在程序里引用： Html.fromHtml(getResources().getString(R.string.myHeadStr)); 效果图 android string html标签用法 string.xml代码 Code   ViewCopyPrint &amp;#60;string name=&quot;test&quot;&amp;#62;&amp;#60;Data&amp;#62;&amp;#60;![CDATA[ &amp;#60;b&amp;#62;&amp;#60;font color=&quot;#ff0000&quot;&amp;#62;ABC&amp;#60;/font&amp;#62;&amp;#60;/b&amp;#62; ]]&amp;#62;&amp;#60;/Data&amp;#62;&amp;#60;/string&amp;#62;   java代码： Code   ViewCopyPrint import android.app.Activity;    import android.app.AlertDialog;    import android.content.DialogInterface;    import android.os.Bundle;    import android.text.Html;       public class testActivity extends Activity {        public void onCreate(Bundle savedInstanceState) {            super.onCreate(savedInstanceState);            AlertDialog.Builder dialog = new AlertDialog.Builder(testActivity.this);            dialog.setTitle(&quot;测试HTML标签&quot;).setMessage(Html.fromHtml(getString(R.string.test))).setPositiveButton(getString(R.string.btn_confirm), new DialogInterface.OnClickListener() {                public void onClick(DialogInterface dialog, int which) {                   }            }).create().show();        }    }   &lt;img src=&quot;http://www1.feedsky.com/t1/608513713/chendw/feedsky/s.gif?r=http://www.chendw.cn/programming/606.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><category>编程技术</category><category>Android</category><category>Java</category><pubDate>Wed, 21 Dec 2011 16:07:59 +0800</pubDate><author>随风散忆</author><comments>http://www.chendw.cn/programming/606.html#comments</comments><guid isPermaLink="false">http://www.chendw.cn/?p=606</guid><dc:creator>随风散忆</dc:creator><fs:srclink>http://www.chendw.cn/programming/606.html</fs:srclink><fs:srcfeed>http://www.chendw.cn/feed</fs:srcfeed><fs:itemid>feedsky/chendw/~8582565/608513713/6687410</fs:itemid></item><item><title>Android 菜单(OptionMenu)大全 建立你自己的菜单[转]</title><link>http://www.chendw.cn/programming/588.html</link><content:encoded>&lt;p&gt;菜单是用户界面中最常见的元素之一，使用非常频繁，在Android中，菜单被分为如下三种，选项菜单（OptionsMenu）、上下文菜单（ContextMenu）和子菜单（SubMenu），今天这讲是OptionsMenu&lt;/p&gt;
&lt;p&gt;一、概述&lt;/p&gt;
&lt;p&gt;public boolean onCreateOptionsMenu(Menu menu)：使用此方法调用OptionsMenu　。&lt;/p&gt;
&lt;p&gt;public boolean onOptionsItemSelected(MenuItem item)：选中菜单项后发生的动作。&lt;/p&gt;
&lt;p&gt;public void onOptionsMenuClosed(Menu menu):菜单关闭后发生的动作。&lt;/p&gt;
&lt;p&gt;public boolean onPrepareOptionsMenu(Menu menu)：选项菜单显示之前onPrepareOptionsMenu方法会被调用，你可以用此方法来根据打当时的情况调整菜单。&lt;/p&gt;
&lt;p&gt;public boolean onMenuOpened(int featureId, Menu menu)：单打开后发生的动作。&lt;/p&gt;
&lt;p&gt;二、默认样式&lt;/p&gt;
&lt;p&gt;默认样式是在屏幕底部弹出一个菜单，这个菜单我们就叫他选项菜单OptionsMenu，一般情况下，选项菜单最多显示2排每排3个菜单项，这些菜单项有文字有图标，也被称作Icon Menus，如果多于6项，从第六项开始会被隐藏，在第六项会出现一个More里，点击More才出现第六项以及以后的菜单项，这些菜单项也被称作Expanded Menus。下面介绍。&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div class=&quot;dp-highlighter&quot;&gt;
&lt;div class=&quot;bar&quot;&gt;
&lt;div class=&quot;tools&quot;&gt;&lt;strong style=&quot;color: #000;&quot;&gt;Code&lt;/strong&gt;   &lt;a onclick=&quot;dp.sh.Toolbar.Command('ViewSource',this);return false;&quot; href=&quot;file:///D:/Program%20Files/CodeRender(Unmi)/CodeRender.hta#&quot;&gt;View&lt;/a&gt;&lt;a onclick=&quot;dp.sh.Toolbar.Command('CopyToClipboard',this);return false;&quot; href=&quot;file:///D:/Program%20Files/CodeRender(Unmi)/CodeRender.hta#&quot;&gt;Copy&lt;/a&gt;&lt;a onclick=&quot;dp.sh.Toolbar.Command('PrintSource',this);return false;&quot; href=&quot;file:///D:/Program%20Files/CodeRender(Unmi)/CodeRender.hta#&quot;&gt;Print&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;ol class=&quot;dp-xml&quot;&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;&lt;span class=&quot;tag&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;tag-name&quot;&gt;TextView&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;attribute&quot;&gt;android:layout_width&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;attribute-value&quot;&gt;&quot;wrap_content&quot;&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;attribute&quot;&gt;android:layout_height&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;attribute-value&quot;&gt;&quot;wrap_content&quot;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;attribute&quot;&gt;android:text&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;attribute-value&quot;&gt;&quot;请点击 Menu键显示选项菜单&quot;&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;attribute&quot;&gt;android:id&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;attribute-value&quot;&gt;&quot;@+id/TextView02&quot;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;tag&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;tag&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;tag-name&quot;&gt;LinearLayout&lt;/span&gt;&lt;span class=&quot;tag&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;p&gt;2。重载onCreateOptionsMenu(Menu menu)方法&lt;br /&gt;
重载onCreateOptionsMenu(Menu menu)方法，并在此方法中添加菜单项，最后返回true，如果false，菜单则不会显示。&lt;/p&gt;
&lt;div class=&quot;dp-highlighter&quot;&gt;
&lt;div class=&quot;bar&quot;&gt;
&lt;div class=&quot;tools&quot;&gt;&lt;strong style=&quot;color: #000;&quot;&gt;Code&lt;/strong&gt;   &lt;a onclick=&quot;dp.sh.Toolbar.Command('ViewSource',this);return false;&quot; href=&quot;file:///D:/Program%20Files/CodeRender(Unmi)/CodeRender.hta#&quot;&gt;View&lt;/a&gt;&lt;a onclick=&quot;dp.sh.Toolbar.Command('CopyToClipboard',this);return false;&quot; href=&quot;file:///D:/Program%20Files/CodeRender(Unmi)/CodeRender.hta#&quot;&gt;Copy&lt;/a&gt;&lt;a onclick=&quot;dp.sh.Toolbar.Command('PrintSource',this);return false;&quot; href=&quot;file:///D:/Program%20Files/CodeRender(Unmi)/CodeRender.hta#&quot;&gt;Print&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;ol class=&quot;dp-j&quot;&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;&lt;span class=&quot;annotation&quot;&gt;@Override&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;boolean&lt;/span&gt;&lt;span&gt; onCreateOptionsMenu(Menu menu) {   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;/* &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&lt;span class=&quot;comment&quot;&gt;         *  &lt;/span&gt; &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;&lt;span class=&quot;comment&quot;&gt;         * add()方法的四个参数，依次是： &lt;/span&gt; &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&lt;span class=&quot;comment&quot;&gt;         *  &lt;/span&gt; &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;&lt;span class=&quot;comment&quot;&gt;         * 1、组别，如果不分组的话就写Menu.NONE, &lt;/span&gt; &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&lt;span class=&quot;comment&quot;&gt;         *  &lt;/span&gt; &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;&lt;span class=&quot;comment&quot;&gt;         * 2、Id，这个很重要，Android根据这个Id来确定不同的菜单 &lt;/span&gt; &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&lt;span class=&quot;comment&quot;&gt;         *  &lt;/span&gt; &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;&lt;span class=&quot;comment&quot;&gt;         * 3、顺序，那个菜单现在在前面由这个参数的大小决定 &lt;/span&gt; &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&lt;span class=&quot;comment&quot;&gt;         *  &lt;/span&gt; &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;&lt;span class=&quot;comment&quot;&gt;         * 4、文本，菜单的显示文本 &lt;/span&gt; &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&lt;span class=&quot;comment&quot;&gt;         */&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        menu.add(Menu.NONE, Menu.FIRST + &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;1&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;5&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;删除&quot;&lt;/span&gt;&lt;span&gt;).setIcon(   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        android.R.drawable.ic_menu_delete);   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;// setIcon()方法为菜单设置图标，这里使用的是系统自带的图标，同学们留意一下,以 &lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;// android.R开头的资源是系统提供的，我们自己提供的资源是以R开头的 &lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        menu.add(Menu.NONE, Menu.FIRST + &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;2&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;2&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;保存&quot;&lt;/span&gt;&lt;span&gt;).setIcon(   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        android.R.drawable.ic_menu_edit);   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        menu.add(Menu.NONE, Menu.FIRST + &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;3&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;6&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;帮助&quot;&lt;/span&gt;&lt;span&gt;).setIcon(   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        android.R.drawable.ic_menu_help);   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        menu.add(Menu.NONE, Menu.FIRST + &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;4&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;1&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;添加&quot;&lt;/span&gt;&lt;span&gt;).setIcon(   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        android.R.drawable.ic_menu_add);   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        menu.add(Menu.NONE, Menu.FIRST + &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;5&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;4&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;详细&quot;&lt;/span&gt;&lt;span&gt;).setIcon(   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        android.R.drawable.ic_menu_info_details);   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        menu.add(Menu.NONE, Menu.FIRST + &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;6&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;3&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;发送&quot;&lt;/span&gt;&lt;span&gt;).setIcon(   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        android.R.drawable.ic_menu_send);   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;return&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;true&lt;/span&gt;&lt;span&gt;;   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;    }  &lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;p&gt;3。为菜单项注册事件&lt;br /&gt;
使用onOptionsItemSelected(MenuItem item)方法为菜单项注册事件&lt;/p&gt;
&lt;div class=&quot;dp-highlighter&quot;&gt;
&lt;div class=&quot;bar&quot;&gt;
&lt;div class=&quot;tools&quot;&gt;&lt;strong style=&quot;color: #000;&quot;&gt;Code&lt;/strong&gt;   &lt;a onclick=&quot;dp.sh.Toolbar.Command('ViewSource',this);return false;&quot; href=&quot;file:///D:/Program%20Files/CodeRender(Unmi)/CodeRender.hta#&quot;&gt;View&lt;/a&gt;&lt;a onclick=&quot;dp.sh.Toolbar.Command('CopyToClipboard',this);return false;&quot; href=&quot;file:///D:/Program%20Files/CodeRender(Unmi)/CodeRender.hta#&quot;&gt;Copy&lt;/a&gt;&lt;a onclick=&quot;dp.sh.Toolbar.Command('PrintSource',this);return false;&quot; href=&quot;file:///D:/Program%20Files/CodeRender(Unmi)/CodeRender.hta#&quot;&gt;Print&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;ol class=&quot;dp-j&quot;&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;&lt;span class=&quot;annotation&quot;&gt;@Override&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;boolean&lt;/span&gt;&lt;span&gt; onOptionsItemSelected(MenuItem item) {   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;switch&lt;/span&gt;&lt;span&gt; (item.getItemId()) {   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;case&lt;/span&gt;&lt;span&gt; Menu.FIRST + &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;1&lt;/span&gt;&lt;span&gt;:   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;            Toast.makeText(&lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;this&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;删除菜单被点击了&quot;&lt;/span&gt;&lt;span&gt;, Toast.LENGTH_LONG).show();   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;            &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;break&lt;/span&gt;&lt;span&gt;;   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;case&lt;/span&gt;&lt;span&gt; Menu.FIRST + &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;2&lt;/span&gt;&lt;span&gt;:   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;            Toast.makeText(&lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;this&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;保存菜单被点击了&quot;&lt;/span&gt;&lt;span&gt;, Toast.LENGTH_LONG).show();   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;            &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;break&lt;/span&gt;&lt;span&gt;;   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;case&lt;/span&gt;&lt;span&gt; Menu.FIRST + &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;3&lt;/span&gt;&lt;span&gt;:   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;            Toast.makeText(&lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;this&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;帮助菜单被点击了&quot;&lt;/span&gt;&lt;span&gt;, Toast.LENGTH_LONG).show();   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;            &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;break&lt;/span&gt;&lt;span&gt;;   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;case&lt;/span&gt;&lt;span&gt; Menu.FIRST + &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;4&lt;/span&gt;&lt;span&gt;:   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;            Toast.makeText(&lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;this&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;添加菜单被点击了&quot;&lt;/span&gt;&lt;span&gt;, Toast.LENGTH_LONG).show();   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;            &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;break&lt;/span&gt;&lt;span&gt;;   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;case&lt;/span&gt;&lt;span&gt; Menu.FIRST + &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;5&lt;/span&gt;&lt;span&gt;:   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;            Toast.makeText(&lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;this&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;详细菜单被点击了&quot;&lt;/span&gt;&lt;span&gt;, Toast.LENGTH_LONG).show();   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;            &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;break&lt;/span&gt;&lt;span&gt;;   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;case&lt;/span&gt;&lt;span&gt; Menu.FIRST + &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;6&lt;/span&gt;&lt;span&gt;:   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;            Toast.makeText(&lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;this&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;发送菜单被点击了&quot;&lt;/span&gt;&lt;span&gt;, Toast.LENGTH_LONG).show();   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;            &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;break&lt;/span&gt;&lt;span&gt;;   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        }   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;return&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;false&lt;/span&gt;&lt;span&gt;;   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;    }  &lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;p&gt;4。其他按需要重载&lt;br /&gt;
完整代码&lt;/p&gt;
&lt;div class=&quot;dp-highlighter&quot;&gt;
&lt;div class=&quot;bar&quot;&gt;
&lt;div class=&quot;tools&quot;&gt;&lt;strong style=&quot;color: #000;&quot;&gt;Code&lt;/strong&gt;   &lt;a onclick=&quot;dp.sh.Toolbar.Command('ViewSource',this);return false;&quot; href=&quot;file:///D:/Program%20Files/CodeRender(Unmi)/CodeRender.hta#&quot;&gt;View&lt;/a&gt;&lt;a onclick=&quot;dp.sh.Toolbar.Command('CopyToClipboard',this);return false;&quot; href=&quot;file:///D:/Program%20Files/CodeRender(Unmi)/CodeRender.hta#&quot;&gt;Copy&lt;/a&gt;&lt;a onclick=&quot;dp.sh.Toolbar.Command('PrintSource',this);return false;&quot; href=&quot;file:///D:/Program%20Files/CodeRender(Unmi)/CodeRender.hta#&quot;&gt;Print&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;ol class=&quot;dp-j&quot;&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;&lt;span class=&quot;keyword&quot;&gt;package&lt;/span&gt;&lt;span&gt; com.wjq.menu;   &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span class=&quot;keyword&quot;&gt;import&lt;/span&gt;&lt;span&gt; android.app.Activity;   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;keyword&quot;&gt;import&lt;/span&gt;&lt;span&gt; android.os.Bundle;   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span class=&quot;keyword&quot;&gt;import&lt;/span&gt;&lt;span&gt; android.view.Menu;   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;keyword&quot;&gt;import&lt;/span&gt;&lt;span&gt; android.view.MenuItem;   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span class=&quot;keyword&quot;&gt;import&lt;/span&gt;&lt;span&gt; android.widget.Toast;   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span class=&quot;keyword&quot;&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;class&lt;/span&gt;&lt;span&gt; DefaultMenu &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;extends&lt;/span&gt;&lt;span&gt; Activity {   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;/** Called when the activity is first created. */&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;annotation&quot;&gt;@Override&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;void&lt;/span&gt;&lt;span&gt; onCreate(Bundle savedInstanceState) {   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;super&lt;/span&gt;&lt;span&gt;.onCreate(savedInstanceState);   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        setContentView(R.layout.main);   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;    }   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;annotation&quot;&gt;@Override&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;boolean&lt;/span&gt;&lt;span&gt; onCreateOptionsMenu(Menu menu) {   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;/* &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&lt;span class=&quot;comment&quot;&gt;         *  &lt;/span&gt; &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;&lt;span class=&quot;comment&quot;&gt;         * add()方法的四个参数，依次是： &lt;/span&gt; &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&lt;span class=&quot;comment&quot;&gt;         *  &lt;/span&gt; &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;&lt;span class=&quot;comment&quot;&gt;         * 1、组别，如果不分组的话就写Menu.NONE, &lt;/span&gt; &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&lt;span class=&quot;comment&quot;&gt;         *  &lt;/span&gt; &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;&lt;span class=&quot;comment&quot;&gt;         * 2、Id，这个很重要，Android根据这个Id来确定不同的菜单 &lt;/span&gt; &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&lt;span class=&quot;comment&quot;&gt;         *  &lt;/span&gt; &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;&lt;span class=&quot;comment&quot;&gt;         * 3、顺序，那个菜单现在在前面由这个参数的大小决定 &lt;/span&gt; &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&lt;span class=&quot;comment&quot;&gt;         *  &lt;/span&gt; &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;&lt;span class=&quot;comment&quot;&gt;         * 4、文本，菜单的显示文本 &lt;/span&gt; &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&lt;span class=&quot;comment&quot;&gt;         */&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        menu.add(Menu.NONE, Menu.FIRST + &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;1&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;5&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;删除&quot;&lt;/span&gt;&lt;span&gt;).setIcon(   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        android.R.drawable.ic_menu_delete);   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;// setIcon()方法为菜单设置图标，这里使用的是系统自带的图标，同学们留意一下,以 &lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;// android.R开头的资源是系统提供的，我们自己提供的资源是以R开头的 &lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        menu.add(Menu.NONE, Menu.FIRST + &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;2&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;2&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;保存&quot;&lt;/span&gt;&lt;span&gt;).setIcon(   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        android.R.drawable.ic_menu_edit);   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        menu.add(Menu.NONE, Menu.FIRST + &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;3&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;6&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;帮助&quot;&lt;/span&gt;&lt;span&gt;).setIcon(   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        android.R.drawable.ic_menu_help);   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        menu.add(Menu.NONE, Menu.FIRST + &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;4&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;1&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;添加&quot;&lt;/span&gt;&lt;span&gt;).setIcon(   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        android.R.drawable.ic_menu_add);   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        menu.add(Menu.NONE, Menu.FIRST + &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;5&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;4&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;详细&quot;&lt;/span&gt;&lt;span&gt;).setIcon(   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        android.R.drawable.ic_menu_info_details);   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        menu.add(Menu.NONE, Menu.FIRST + &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;6&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;3&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;发送&quot;&lt;/span&gt;&lt;span&gt;).setIcon(   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        android.R.drawable.ic_menu_send);   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;return&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;true&lt;/span&gt;&lt;span&gt;;   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;    }   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;annotation&quot;&gt;@Override&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;boolean&lt;/span&gt;&lt;span&gt; onOptionsItemSelected(MenuItem item) {   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;switch&lt;/span&gt;&lt;span&gt; (item.getItemId()) {   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;case&lt;/span&gt;&lt;span&gt; Menu.FIRST + &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;1&lt;/span&gt;&lt;span&gt;:   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;            Toast.makeText(&lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;this&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;删除菜单被点击了&quot;&lt;/span&gt;&lt;span&gt;, Toast.LENGTH_LONG).show();   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;            &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;break&lt;/span&gt;&lt;span&gt;;   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;case&lt;/span&gt;&lt;span&gt; Menu.FIRST + &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;2&lt;/span&gt;&lt;span&gt;:   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;            Toast.makeText(&lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;this&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;保存菜单被点击了&quot;&lt;/span&gt;&lt;span&gt;, Toast.LENGTH_LONG).show();   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;            &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;break&lt;/span&gt;&lt;span&gt;;   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;case&lt;/span&gt;&lt;span&gt; Menu.FIRST + &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;3&lt;/span&gt;&lt;span&gt;:   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;            Toast.makeText(&lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;this&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;帮助菜单被点击了&quot;&lt;/span&gt;&lt;span&gt;, Toast.LENGTH_LONG).show();   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;            &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;break&lt;/span&gt;&lt;span&gt;;   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;case&lt;/span&gt;&lt;span&gt; Menu.FIRST + &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;4&lt;/span&gt;&lt;span&gt;:   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;            Toast.makeText(&lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;this&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;添加菜单被点击了&quot;&lt;/span&gt;&lt;span&gt;, Toast.LENGTH_LONG).show();   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;            &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;break&lt;/span&gt;&lt;span&gt;;   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;case&lt;/span&gt;&lt;span&gt; Menu.FIRST + &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;5&lt;/span&gt;&lt;span&gt;:   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;            Toast.makeText(&lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;this&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;详细菜单被点击了&quot;&lt;/span&gt;&lt;span&gt;, Toast.LENGTH_LONG).show();   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;            &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;break&lt;/span&gt;&lt;span&gt;;   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;case&lt;/span&gt;&lt;span&gt; Menu.FIRST + &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;6&lt;/span&gt;&lt;span&gt;:   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;            Toast.makeText(&lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;this&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;发送菜单被点击了&quot;&lt;/span&gt;&lt;span&gt;, Toast.LENGTH_LONG).show();   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;            &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;break&lt;/span&gt;&lt;span&gt;;   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        }   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;return&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;false&lt;/span&gt;&lt;span&gt;;   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;    }   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;annotation&quot;&gt;@Override&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;void&lt;/span&gt;&lt;span&gt; onOptionsMenuClosed(Menu menu) {   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        Toast.makeText(&lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;this&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;选项菜单关闭了&quot;&lt;/span&gt;&lt;span&gt;, Toast.LENGTH_LONG).show();   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;    }   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;annotation&quot;&gt;@Override&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;boolean&lt;/span&gt;&lt;span&gt; onPrepareOptionsMenu(Menu menu) {   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        Toast.makeText(&lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;this&lt;/span&gt;&lt;span&gt;,   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;                &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;选项菜单显示之前onPrepareOptionsMenu方法会被调用，你可以用此方法来根据打当时的情况调整菜单&quot;&lt;/span&gt;&lt;span&gt;,   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;                Toast.LENGTH_LONG).show();   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;// 如果返回false，此方法就把用户点击menu的动作给消费了，onCreateOptionsMenu方法将不会被调用 &lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;return&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;true&lt;/span&gt;&lt;span&gt;;   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;    }   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;}  &lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;p&gt;5.效果浏览&lt;/p&gt;
&lt;p&gt;&lt;img class=&quot;alignnone&quot; title=&quot;效果图&quot; src=&quot;http://www.chendw.cn/wp-content/uploads/auto_save_image/2011/12/012016tFU.png&quot; alt=&quot;&quot; width=&quot;328&quot; height=&quot;483&quot; /&gt;&lt;/p&gt;
&lt;p&gt;三、自定义样式&lt;/p&gt;
&lt;div class=&quot;dp-highlighter&quot;&gt;
&lt;div class=&quot;bar&quot;&gt;
&lt;div class=&quot;tools&quot;&gt;&lt;strong style=&quot;color: #000;&quot;&gt;Code&lt;/strong&gt;   &lt;a onclick=&quot;dp.sh.Toolbar.Command('ViewSource',this);return false;&quot; href=&quot;file:///D:/Program%20Files/CodeRender(Unmi)/CodeRender.hta#&quot;&gt;View&lt;/a&gt;&lt;a onclick=&quot;dp.sh.Toolbar.Command('CopyToClipboard',this);return false;&quot; href=&quot;file:///D:/Program%20Files/CodeRender(Unmi)/CodeRender.hta#&quot;&gt;Copy&lt;/a&gt;&lt;a onclick=&quot;dp.sh.Toolbar.Command('PrintSource',this);return false;&quot; href=&quot;file:///D:/Program%20Files/CodeRender(Unmi)/CodeRender.hta#&quot;&gt;Print&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;ol class=&quot;dp-xml&quot;&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;&lt;span class=&quot;tag&quot;&gt;&amp;lt;?&lt;/span&gt;&lt;span class=&quot;tag-name&quot;&gt;xml&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;attribute&quot;&gt;version&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;attribute-value&quot;&gt;&quot;1.0&quot;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;attribute&quot;&gt;encoding&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;attribute-value&quot;&gt;&quot;utf-8&quot;&lt;/span&gt;&lt;span class=&quot;tag&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;tag&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;tag-name&quot;&gt;LinearLayout&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;attribute&quot;&gt;xmlns:android&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;attribute-value&quot;&gt;&quot;http://schemas.android.com/apk/res/android&quot;&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;attribute&quot;&gt;android:orientation&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;attribute-value&quot;&gt;&quot;vertical&quot;&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;attribute&quot;&gt;android:layout_width&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;attribute-value&quot;&gt;&quot;fill_parent&quot;&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;attribute&quot;&gt;android:layout_height&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;attribute-value&quot;&gt;&quot;fill_parent&quot;&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;tag&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span class=&quot;tag&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;tag-name&quot;&gt;GridView&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;         &lt;/span&gt;&lt;span class=&quot;attribute&quot;&gt;android:id&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;attribute-value&quot;&gt;&quot;@+id/gridview&quot;&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;         &lt;/span&gt;&lt;span class=&quot;attribute&quot;&gt;android:layout_width&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;attribute-value&quot;&gt;&quot;fill_parent&quot;&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;         &lt;/span&gt;&lt;span class=&quot;attribute&quot;&gt;android:layout_height&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;attribute-value&quot;&gt;&quot;fill_parent&quot;&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;         &lt;/span&gt;&lt;span class=&quot;attribute&quot;&gt;android:numColumns&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;attribute-value&quot;&gt;&quot;4&quot;&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;         &lt;/span&gt;&lt;span class=&quot;attribute&quot;&gt;android:verticalSpacing&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;attribute-value&quot;&gt;&quot;10dip&quot;&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;         &lt;/span&gt;&lt;span class=&quot;attribute&quot;&gt;android:horizontalSpacing&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;attribute-value&quot;&gt;&quot;10dip&quot;&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;         &lt;/span&gt;&lt;span class=&quot;attribute&quot;&gt;android:stretchMode&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;attribute-value&quot;&gt;&quot;columnWidth&quot;&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;         &lt;/span&gt;&lt;span class=&quot;attribute&quot;&gt;android:gravity&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;attribute-value&quot;&gt;&quot;center&quot;&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;         &lt;/span&gt;&lt;span class=&quot;tag&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;     &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;tag&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;tag-name&quot;&gt;LinearLayout&lt;/span&gt;&lt;span class=&quot;tag&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;p&gt;首先自定义菜单界面，我是GridView来包含菜单项，4列3行&lt;/p&gt;
&lt;div class=&quot;dp-highlighter&quot;&gt;
&lt;div class=&quot;bar&quot;&gt;
&lt;div class=&quot;tools&quot;&gt;&lt;strong style=&quot;color: #000;&quot;&gt;Code&lt;/strong&gt;   &lt;a onclick=&quot;dp.sh.Toolbar.Command('ViewSource',this);return false;&quot; href=&quot;file:///D:/Program%20Files/CodeRender(Unmi)/CodeRender.hta#&quot;&gt;View&lt;/a&gt;&lt;a onclick=&quot;dp.sh.Toolbar.Command('CopyToClipboard',this);return false;&quot; href=&quot;file:///D:/Program%20Files/CodeRender(Unmi)/CodeRender.hta#&quot;&gt;Copy&lt;/a&gt;&lt;a onclick=&quot;dp.sh.Toolbar.Command('PrintSource',this);return false;&quot; href=&quot;file:///D:/Program%20Files/CodeRender(Unmi)/CodeRender.hta#&quot;&gt;Print&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;ol class=&quot;dp-xml&quot;&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;&lt;span class=&quot;tag&quot;&gt;&amp;lt;?&lt;/span&gt;&lt;span class=&quot;tag-name&quot;&gt;xml&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;attribute&quot;&gt;version&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;attribute-value&quot;&gt;&quot;1.0&quot;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;attribute&quot;&gt;encoding&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;attribute-value&quot;&gt;&quot;utf-8&quot;&lt;/span&gt;&lt;span class=&quot;tag&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;tag&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;tag-name&quot;&gt;RelativeLayout&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;attribute&quot;&gt;xmlns:android&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;attribute-value&quot;&gt;&quot;http://schemas.android.com/apk/res/android&quot;&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;attribute&quot;&gt;android:id&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;attribute-value&quot;&gt;&quot;@+id/RelativeLayout_Item&quot;&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;attribute&quot;&gt;android:layout_width&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;attribute-value&quot;&gt;&quot;fill_parent&quot;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;attribute&quot;&gt;android:layout_height&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;attribute-value&quot;&gt;&quot;wrap_content&quot;&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;attribute&quot;&gt;android:paddingBottom&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;attribute-value&quot;&gt;&quot;5dip&quot;&lt;/span&gt;&lt;span class=&quot;tag&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;tag&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;tag-name&quot;&gt;ImageView&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;attribute&quot;&gt;android:id&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;attribute-value&quot;&gt;&quot;@+id/item_image&quot;&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;attribute&quot;&gt;android:layout_centerHorizontal&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;attribute-value&quot;&gt;&quot;true&quot;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;attribute&quot;&gt;android:layout_width&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;attribute-value&quot;&gt;&quot;wrap_content&quot;&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;attribute&quot;&gt;android:layout_height&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;attribute-value&quot;&gt;&quot;wrap_content&quot;&lt;/span&gt;&lt;span class=&quot;tag&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;tag&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;tag-name&quot;&gt;ImageView&lt;/span&gt;&lt;span class=&quot;tag&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;tag&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;tag-name&quot;&gt;TextView&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;attribute&quot;&gt;android:layout_below&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;attribute-value&quot;&gt;&quot;@id/item_image&quot;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;attribute&quot;&gt;android:id&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;attribute-value&quot;&gt;&quot;@+id/item_text&quot;&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;attribute&quot;&gt;android:layout_centerHorizontal&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;attribute-value&quot;&gt;&quot;true&quot;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;attribute&quot;&gt;android:layout_width&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;attribute-value&quot;&gt;&quot;wrap_content&quot;&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;attribute&quot;&gt;android:layout_height&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;attribute-value&quot;&gt;&quot;wrap_content&quot;&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;attribute&quot;&gt;android:text&lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span class=&quot;attribute-value&quot;&gt;&quot;选项&quot;&lt;/span&gt;&lt;span class=&quot;tag&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;tag&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;tag-name&quot;&gt;TextView&lt;/span&gt;&lt;span class=&quot;tag&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;tag&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;tag-name&quot;&gt;RelativeLayout&lt;/span&gt;&lt;span class=&quot;tag&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;p&gt;菜单项的现实样式，一个图标和一个文字。&lt;br /&gt;
3.定义&lt;/p&gt;
&lt;div class=&quot;dp-highlighter&quot;&gt;
&lt;div class=&quot;bar&quot;&gt;
&lt;div class=&quot;tools&quot;&gt;&lt;strong style=&quot;color: #000;&quot;&gt;Code&lt;/strong&gt;   &lt;a onclick=&quot;dp.sh.Toolbar.Command('ViewSource',this);return false;&quot; href=&quot;file:///D:/Program%20Files/CodeRender(Unmi)/CodeRender.hta#&quot;&gt;View&lt;/a&gt;&lt;a onclick=&quot;dp.sh.Toolbar.Command('CopyToClipboard',this);return false;&quot; href=&quot;file:///D:/Program%20Files/CodeRender(Unmi)/CodeRender.hta#&quot;&gt;Copy&lt;/a&gt;&lt;a onclick=&quot;dp.sh.Toolbar.Command('PrintSource',this);return false;&quot; href=&quot;file:///D:/Program%20Files/CodeRender(Unmi)/CodeRender.hta#&quot;&gt;Print&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;ol class=&quot;dp-j&quot;&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;&lt;span class=&quot;keyword&quot;&gt;private&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;boolean&lt;/span&gt;&lt;span&gt; isMore = &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;false&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;// menu菜单翻页控制 &lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;    AlertDialog menuDialog;&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;// menu菜单Dialog &lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;    GridView menuGrid;   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;    View menuView;   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;       &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;private&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;final&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;int&lt;/span&gt;&lt;span&gt; ITEM_SEARCH = &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;0&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;// 搜索 &lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;private&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;final&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;int&lt;/span&gt;&lt;span&gt; ITEM_FILE_MANAGER = &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;1&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;// 文件管理 &lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;private&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;final&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;int&lt;/span&gt;&lt;span&gt; ITEM_DOWN_MANAGER = &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;2&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;// 下载管理 &lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;private&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;final&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;int&lt;/span&gt;&lt;span&gt; ITEM_FULLSCREEN = &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;3&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;// 全屏 &lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;private&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;final&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;int&lt;/span&gt;&lt;span&gt; ITEM_MORE = &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;11&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;// 菜单 &lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;       &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;/** 菜单图片 **/&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;int&lt;/span&gt;&lt;span&gt;[] menu_image_array = { R.drawable.menu_search,   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;            R.drawable.menu_filemanager, R.drawable.menu_downmanager,   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;            R.drawable.menu_fullscreen, R.drawable.menu_inputurl,   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;            R.drawable.menu_bookmark, R.drawable.menu_bookmark_sync_import,   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;            R.drawable.menu_sharepage, R.drawable.menu_quit,   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;            R.drawable.menu_nightmode, R.drawable.menu_refresh,   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;            R.drawable.menu_more };   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;/** 菜单文字 **/&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;    String[] menu_name_array = { &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;搜索&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;文件管理&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;下载管理&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;全屏&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;网址&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;书签&quot;&lt;/span&gt;&lt;span&gt;,   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;            &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;加入书签&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;分享页面&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;退出&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;夜间模式&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;刷新&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;更多&quot;&lt;/span&gt;&lt;span&gt; };   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;/** 菜单图片2 **/&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;int&lt;/span&gt;&lt;span&gt;[] menu_image_array2 = { R.drawable.menu_auto_landscape,   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;            R.drawable.menu_penselectmodel, R.drawable.menu_page_attr,   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;            R.drawable.menu_novel_mode, R.drawable.menu_page_updown,   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;            R.drawable.menu_checkupdate, R.drawable.menu_checknet,   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;            R.drawable.menu_refreshtimer, R.drawable.menu_syssettings,   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;            R.drawable.menu_help, R.drawable.menu_about, R.drawable.menu_return };   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;/** 菜单文字2 **/&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;    String[] menu_name_array2 = { &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;自动横屏&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;笔选模式&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;阅读模式&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;浏览模式&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;快捷翻页&quot;&lt;/span&gt;&lt;span&gt;,   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;            &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;检查更新&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;检查网络&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;定时刷新&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;设置&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;帮助&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;关于&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;返回&quot;&lt;/span&gt;&lt;span&gt; };  &lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;div class=&quot;dp-highlighter&quot;&gt;
&lt;div class=&quot;bar&quot;&gt;
&lt;div class=&quot;tools&quot;&gt;&lt;strong style=&quot;color: #000;&quot;&gt;Code&lt;/strong&gt;   &lt;a onclick=&quot;dp.sh.Toolbar.Command('ViewSource',this);return false;&quot; href=&quot;file:///D:/Program%20Files/CodeRender(Unmi)/CodeRender.hta#&quot;&gt;View&lt;/a&gt;&lt;a onclick=&quot;dp.sh.Toolbar.Command('CopyToClipboard',this);return false;&quot; href=&quot;file:///D:/Program%20Files/CodeRender(Unmi)/CodeRender.hta#&quot;&gt;Copy&lt;/a&gt;&lt;a onclick=&quot;dp.sh.Toolbar.Command('PrintSource',this);return false;&quot; href=&quot;file:///D:/Program%20Files/CodeRender(Unmi)/CodeRender.hta#&quot;&gt;Print&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;ol class=&quot;dp-j&quot;&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;&lt;span class=&quot;annotation&quot;&gt;@Override&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;boolean&lt;/span&gt;&lt;span&gt; onMenuOpened(&lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;int&lt;/span&gt;&lt;span&gt; featureId, Menu menu) {   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;if&lt;/span&gt;&lt;span&gt; (menuDialog == &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;null&lt;/span&gt;&lt;span&gt;) {   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;            menuDialog = &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;new&lt;/span&gt;&lt;span&gt; AlertDialog.Builder(&lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;this&lt;/span&gt;&lt;span&gt;).setView(menuView).show();   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        } &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;else&lt;/span&gt;&lt;span&gt; {   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;            menuDialog.show();   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        }   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;return&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;false&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;// 返回为true 则显示系统menu &lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;    }  &lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;p&gt;如果第一次打开则设置视图，否则直接显示menuDialog视图。&lt;/p&gt;
&lt;div class=&quot;dp-highlighter&quot;&gt;
&lt;div class=&quot;bar&quot;&gt;
&lt;div class=&quot;tools&quot;&gt;&lt;strong style=&quot;color: #000;&quot;&gt;Code&lt;/strong&gt;   &lt;a onclick=&quot;dp.sh.Toolbar.Command('ViewSource',this);return false;&quot; href=&quot;file:///D:/Program%20Files/CodeRender(Unmi)/CodeRender.hta#&quot;&gt;View&lt;/a&gt;&lt;a onclick=&quot;dp.sh.Toolbar.Command('CopyToClipboard',this);return false;&quot; href=&quot;file:///D:/Program%20Files/CodeRender(Unmi)/CodeRender.hta#&quot;&gt;Copy&lt;/a&gt;&lt;a onclick=&quot;dp.sh.Toolbar.Command('PrintSource',this);return false;&quot; href=&quot;file:///D:/Program%20Files/CodeRender(Unmi)/CodeRender.hta#&quot;&gt;Print&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;ol class=&quot;dp-j&quot;&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;&lt;span class=&quot;keyword&quot;&gt;private&lt;/span&gt;&lt;span&gt; SimpleAdapter getMenuAdapter(String[] menuNameArray,   &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;            &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;int&lt;/span&gt;&lt;span&gt;[] imageResourceArray) {   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        ArrayList&amp;lt;HashMap&amp;lt;String, Object&amp;gt;&amp;gt; data = &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;new&lt;/span&gt;&lt;span&gt; ArrayList&amp;lt;HashMap&amp;lt;String, Object&amp;gt;&amp;gt;();   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;for&lt;/span&gt;&lt;span&gt; (&lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;int&lt;/span&gt;&lt;span&gt; i = &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;0&lt;/span&gt;&lt;span&gt;; i &amp;lt; menuNameArray.length; i++) {   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;            HashMap&amp;lt;String, Object&amp;gt; map = &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;new&lt;/span&gt;&lt;span&gt; HashMap&amp;lt;String, Object&amp;gt;();   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;            map.put(&lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;itemImage&quot;&lt;/span&gt;&lt;span&gt;, imageResourceArray[i]);   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;            map.put(&lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;itemText&quot;&lt;/span&gt;&lt;span&gt;, menuNameArray[i]);   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;            data.add(map);   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        }   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        SimpleAdapter simperAdapter = &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;new&lt;/span&gt;&lt;span&gt; SimpleAdapter(&lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;this&lt;/span&gt;&lt;span&gt;, data,   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;                R.layout.item_menu, &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;new&lt;/span&gt;&lt;span&gt; String[] { &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;itemImage&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;itemText&quot;&lt;/span&gt;&lt;span&gt; },   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;                &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;new&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;int&lt;/span&gt;&lt;span&gt;[] { R.id.item_image, R.id.item_text });   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;return&lt;/span&gt;&lt;span&gt; simperAdapter;   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;    }  &lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;p&gt;为菜单添加菜单项。&lt;/p&gt;
&lt;div class=&quot;dp-highlighter&quot;&gt;
&lt;div class=&quot;bar&quot;&gt;
&lt;div class=&quot;tools&quot;&gt;&lt;strong style=&quot;color: #000;&quot;&gt;Code&lt;/strong&gt;   &lt;a onclick=&quot;dp.sh.Toolbar.Command('ViewSource',this);return false;&quot; href=&quot;file:///D:/Program%20Files/CodeRender(Unmi)/CodeRender.hta#&quot;&gt;View&lt;/a&gt;&lt;a onclick=&quot;dp.sh.Toolbar.Command('CopyToClipboard',this);return false;&quot; href=&quot;file:///D:/Program%20Files/CodeRender(Unmi)/CodeRender.hta#&quot;&gt;Copy&lt;/a&gt;&lt;a onclick=&quot;dp.sh.Toolbar.Command('PrintSource',this);return false;&quot; href=&quot;file:///D:/Program%20Files/CodeRender(Unmi)/CodeRender.hta#&quot;&gt;Print&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;ol class=&quot;dp-j&quot;&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;&lt;span class=&quot;annotation&quot;&gt;@Override&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;boolean&lt;/span&gt;&lt;span&gt; onCreateOptionsMenu(Menu menu) {   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        menu.add(&lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;menu&quot;&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;// 必须创建一项 &lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;return&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;super&lt;/span&gt;&lt;span&gt;.onCreateOptionsMenu(menu);   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;    }   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;annotation&quot;&gt;@Override&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;protected&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;void&lt;/span&gt;&lt;span&gt; onCreate(Bundle savedInstanceState) {   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;// TODO Auto-generated method stub &lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;super&lt;/span&gt;&lt;span&gt;.onCreate(savedInstanceState);   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;           &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        setContentView(R.layout.main);   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;           &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        menuView = View.inflate(&lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;this&lt;/span&gt;&lt;span&gt;, R.layout.gridview_menu, &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;null&lt;/span&gt;&lt;span&gt;);   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;// 创建AlertDialog &lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        menuDialog = &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;new&lt;/span&gt;&lt;span&gt; AlertDialog.Builder(&lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;this&lt;/span&gt;&lt;span&gt;).create();   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        menuDialog.setView(menuView);   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        menuDialog.setOnKeyListener(&lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;new&lt;/span&gt;&lt;span&gt; OnKeyListener() {   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;            &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;boolean&lt;/span&gt;&lt;span&gt; onKey(DialogInterface dialog, &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;int&lt;/span&gt;&lt;span&gt; keyCode,   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;                    KeyEvent event) {   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;                &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;if&lt;/span&gt;&lt;span&gt; (keyCode == KeyEvent.KEYCODE_MENU)&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;// 监听按键 &lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;                    dialog.dismiss();   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;                &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;return&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;false&lt;/span&gt;&lt;span&gt;;   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;            }   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        });   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        menuGrid = (GridView) menuView.findViewById(R.id.gridview);   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        menuGrid.setAdapter(getMenuAdapter(menu_name_array, menu_image_array));   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;/** 监听menu选项 **/&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        menuGrid.setOnItemClickListener(&lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;new&lt;/span&gt;&lt;span&gt; OnItemClickListener() {   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;            &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;void&lt;/span&gt;&lt;span&gt; onItemClick(AdapterView&amp;lt;?&amp;gt; arg0, View arg1, &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;int&lt;/span&gt;&lt;span&gt; arg2,   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;                    &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;long&lt;/span&gt;&lt;span&gt; arg3) {   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;                &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;switch&lt;/span&gt;&lt;span&gt; (arg2) {   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;                &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;case&lt;/span&gt;&lt;span&gt; ITEM_SEARCH:&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;// 搜索 &lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;                    &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;break&lt;/span&gt;&lt;span&gt;;   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;                &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;case&lt;/span&gt;&lt;span&gt; ITEM_FILE_MANAGER:&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;// 文件管理 &lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;                    &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;break&lt;/span&gt;&lt;span&gt;;   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;                &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;case&lt;/span&gt;&lt;span&gt; ITEM_DOWN_MANAGER:&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;// 下载管理 &lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;                    &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;break&lt;/span&gt;&lt;span&gt;;   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;                &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;case&lt;/span&gt;&lt;span&gt; ITEM_FULLSCREEN:&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;// 全屏 &lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;                    &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;break&lt;/span&gt;&lt;span&gt;;   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;                &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;case&lt;/span&gt;&lt;span&gt; ITEM_MORE:&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;// 翻页 &lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;                    &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;if&lt;/span&gt;&lt;span&gt; (isMore) {   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;                        menuGrid.setAdapter(getMenuAdapter(menu_name_array2,   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;                                menu_image_array2));   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;                        isMore = &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;false&lt;/span&gt;&lt;span&gt;;   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;                    } &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;else&lt;/span&gt;&lt;span&gt; {&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;// 首页 &lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;                        menuGrid.setAdapter(getMenuAdapter(menu_name_array,   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;                                menu_image_array));   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;                        isMore = &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;true&lt;/span&gt;&lt;span&gt;;   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;                    }   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;                    menuGrid.invalidate();&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;// 更新menu &lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;                    menuGrid.setSelection(ITEM_MORE);   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;                    &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;break&lt;/span&gt;&lt;span&gt;;   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;                }   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;                   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;                   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;            }   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        });   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;    }  &lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;p&gt;完整代码：&lt;/p&gt;
&lt;div class=&quot;dp-highlighter&quot;&gt;
&lt;div class=&quot;bar&quot;&gt;
&lt;div class=&quot;tools&quot;&gt;&lt;strong style=&quot;color: #000;&quot;&gt;Code&lt;/strong&gt;   &lt;a onclick=&quot;dp.sh.Toolbar.Command('ViewSource',this);return false;&quot; href=&quot;file:///D:/Program%20Files/CodeRender(Unmi)/CodeRender.hta#&quot;&gt;View&lt;/a&gt;&lt;a onclick=&quot;dp.sh.Toolbar.Command('CopyToClipboard',this);return false;&quot; href=&quot;file:///D:/Program%20Files/CodeRender(Unmi)/CodeRender.hta#&quot;&gt;Copy&lt;/a&gt;&lt;a onclick=&quot;dp.sh.Toolbar.Command('PrintSource',this);return false;&quot; href=&quot;file:///D:/Program%20Files/CodeRender(Unmi)/CodeRender.hta#&quot;&gt;Print&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;ol class=&quot;dp-j&quot;&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;&lt;span class=&quot;keyword&quot;&gt;package&lt;/span&gt;&lt;span&gt; com.wjq.menu;   &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;keyword&quot;&gt;import&lt;/span&gt;&lt;span&gt; java.util.ArrayList;   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span class=&quot;keyword&quot;&gt;import&lt;/span&gt;&lt;span&gt; java.util.HashMap;   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span class=&quot;keyword&quot;&gt;import&lt;/span&gt;&lt;span&gt; android.app.Activity;   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;keyword&quot;&gt;import&lt;/span&gt;&lt;span&gt; android.app.AlertDialog;   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span class=&quot;keyword&quot;&gt;import&lt;/span&gt;&lt;span&gt; android.content.DialogInterface;   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;keyword&quot;&gt;import&lt;/span&gt;&lt;span&gt; android.content.DialogInterface.OnKeyListener;   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span class=&quot;keyword&quot;&gt;import&lt;/span&gt;&lt;span&gt; android.os.Bundle;   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;keyword&quot;&gt;import&lt;/span&gt;&lt;span&gt; android.view.KeyEvent;   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span class=&quot;keyword&quot;&gt;import&lt;/span&gt;&lt;span&gt; android.view.Menu;   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;keyword&quot;&gt;import&lt;/span&gt;&lt;span&gt; android.view.View;   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span class=&quot;keyword&quot;&gt;import&lt;/span&gt;&lt;span&gt; android.widget.AdapterView;   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;keyword&quot;&gt;import&lt;/span&gt;&lt;span&gt; android.widget.GridView;   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span class=&quot;keyword&quot;&gt;import&lt;/span&gt;&lt;span&gt; android.widget.SimpleAdapter;   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;keyword&quot;&gt;import&lt;/span&gt;&lt;span&gt; android.widget.AdapterView.OnItemClickListener;   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;keyword&quot;&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;class&lt;/span&gt;&lt;span&gt; CustomizeMenu &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;extends&lt;/span&gt;&lt;span&gt; Activity {   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;       &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;private&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;boolean&lt;/span&gt;&lt;span&gt; isMore = &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;false&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;// menu菜单翻页控制 &lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;    AlertDialog menuDialog;&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;// menu菜单Dialog &lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;    GridView menuGrid;   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;    View menuView;   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;       &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;private&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;final&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;int&lt;/span&gt;&lt;span&gt; ITEM_SEARCH = &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;0&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;// 搜索 &lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;private&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;final&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;int&lt;/span&gt;&lt;span&gt; ITEM_FILE_MANAGER = &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;1&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;// 文件管理 &lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;private&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;final&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;int&lt;/span&gt;&lt;span&gt; ITEM_DOWN_MANAGER = &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;2&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;// 下载管理 &lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;private&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;final&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;int&lt;/span&gt;&lt;span&gt; ITEM_FULLSCREEN = &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;3&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;// 全屏 &lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;private&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;final&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;int&lt;/span&gt;&lt;span&gt; ITEM_MORE = &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;11&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;// 菜单 &lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;       &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;/** 菜单图片 **/&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;int&lt;/span&gt;&lt;span&gt;[] menu_image_array = { R.drawable.menu_search,   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;            R.drawable.menu_filemanager, R.drawable.menu_downmanager,   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;            R.drawable.menu_fullscreen, R.drawable.menu_inputurl,   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;            R.drawable.menu_bookmark, R.drawable.menu_bookmark_sync_import,   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;            R.drawable.menu_sharepage, R.drawable.menu_quit,   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;            R.drawable.menu_nightmode, R.drawable.menu_refresh,   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;            R.drawable.menu_more };   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;/** 菜单文字 **/&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;    String[] menu_name_array = { &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;搜索&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;文件管理&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;下载管理&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;全屏&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;网址&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;书签&quot;&lt;/span&gt;&lt;span&gt;,   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;            &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;加入书签&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;分享页面&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;退出&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;夜间模式&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;刷新&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;更多&quot;&lt;/span&gt;&lt;span&gt; };   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;/** 菜单图片2 **/&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;int&lt;/span&gt;&lt;span&gt;[] menu_image_array2 = { R.drawable.menu_auto_landscape,   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;            R.drawable.menu_penselectmodel, R.drawable.menu_page_attr,   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;            R.drawable.menu_novel_mode, R.drawable.menu_page_updown,   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;            R.drawable.menu_checkupdate, R.drawable.menu_checknet,   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;            R.drawable.menu_refreshtimer, R.drawable.menu_syssettings,   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;            R.drawable.menu_help, R.drawable.menu_about, R.drawable.menu_return };   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;/** 菜单文字2 **/&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;    String[] menu_name_array2 = { &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;自动横屏&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;笔选模式&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;阅读模式&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;浏览模式&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;快捷翻页&quot;&lt;/span&gt;&lt;span&gt;,   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;            &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;检查更新&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;检查网络&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;定时刷新&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;设置&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;帮助&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;关于&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;返回&quot;&lt;/span&gt;&lt;span&gt; };   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;annotation&quot;&gt;@Override&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;protected&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;void&lt;/span&gt;&lt;span&gt; onCreate(Bundle savedInstanceState) {   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;// TODO Auto-generated method stub &lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;super&lt;/span&gt;&lt;span&gt;.onCreate(savedInstanceState);   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;           &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        setContentView(R.layout.main);   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;           &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        menuView = View.inflate(&lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;this&lt;/span&gt;&lt;span&gt;, R.layout.gridview_menu, &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;null&lt;/span&gt;&lt;span&gt;);   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;// 创建AlertDialog &lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        menuDialog = &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;new&lt;/span&gt;&lt;span&gt; AlertDialog.Builder(&lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;this&lt;/span&gt;&lt;span&gt;).create();   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        menuDialog.setView(menuView);   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        menuDialog.setOnKeyListener(&lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;new&lt;/span&gt;&lt;span&gt; OnKeyListener() {   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;            &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;boolean&lt;/span&gt;&lt;span&gt; onKey(DialogInterface dialog, &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;int&lt;/span&gt;&lt;span&gt; keyCode,   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;                    KeyEvent event) {   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;                &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;if&lt;/span&gt;&lt;span&gt; (keyCode == KeyEvent.KEYCODE_MENU)&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;// 监听按键 &lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;                    dialog.dismiss();   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;                &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;return&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;false&lt;/span&gt;&lt;span&gt;;   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;            }   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        });   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        menuGrid = (GridView) menuView.findViewById(R.id.gridview);   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        menuGrid.setAdapter(getMenuAdapter(menu_name_array, menu_image_array));   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;/** 监听menu选项 **/&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        menuGrid.setOnItemClickListener(&lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;new&lt;/span&gt;&lt;span&gt; OnItemClickListener() {   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;            &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;void&lt;/span&gt;&lt;span&gt; onItemClick(AdapterView&amp;lt;?&amp;gt; arg0, View arg1, &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;int&lt;/span&gt;&lt;span&gt; arg2,   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;                    &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;long&lt;/span&gt;&lt;span&gt; arg3) {   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;                &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;switch&lt;/span&gt;&lt;span&gt; (arg2) {   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;                &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;case&lt;/span&gt;&lt;span&gt; ITEM_SEARCH:&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;// 搜索 &lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;                    &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;break&lt;/span&gt;&lt;span&gt;;   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;                &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;case&lt;/span&gt;&lt;span&gt; ITEM_FILE_MANAGER:&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;// 文件管理 &lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;                    &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;break&lt;/span&gt;&lt;span&gt;;   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;                &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;case&lt;/span&gt;&lt;span&gt; ITEM_DOWN_MANAGER:&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;// 下载管理 &lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;                    &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;break&lt;/span&gt;&lt;span&gt;;   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;                &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;case&lt;/span&gt;&lt;span&gt; ITEM_FULLSCREEN:&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;// 全屏 &lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;                    &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;break&lt;/span&gt;&lt;span&gt;;   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;                &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;case&lt;/span&gt;&lt;span&gt; ITEM_MORE:&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;// 翻页 &lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;                    &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;if&lt;/span&gt;&lt;span&gt; (isMore) {   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;                        menuGrid.setAdapter(getMenuAdapter(menu_name_array2,   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;                                menu_image_array2));   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;                        isMore = &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;false&lt;/span&gt;&lt;span&gt;;   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;                    } &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;else&lt;/span&gt;&lt;span&gt; {&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;// 首页 &lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;                        menuGrid.setAdapter(getMenuAdapter(menu_name_array,   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;                                menu_image_array));   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;                        isMore = &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;true&lt;/span&gt;&lt;span&gt;;   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;                    }   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;                    menuGrid.invalidate();&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;// 更新menu &lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;                    menuGrid.setSelection(ITEM_MORE);   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;                    &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;break&lt;/span&gt;&lt;span&gt;;   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;                }   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;                   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;                   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;            }   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        });   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;    }   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;annotation&quot;&gt;@Override&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;boolean&lt;/span&gt;&lt;span&gt; onCreateOptionsMenu(Menu menu) {   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        menu.add(&lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;menu&quot;&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;// 必须创建一项 &lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;return&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;super&lt;/span&gt;&lt;span&gt;.onCreateOptionsMenu(menu);   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;    }   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;       &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;private&lt;/span&gt;&lt;span&gt; SimpleAdapter getMenuAdapter(String[] menuNameArray,   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;            &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;int&lt;/span&gt;&lt;span&gt;[] imageResourceArray) {   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        ArrayList&amp;lt;HashMap&amp;lt;String, Object&amp;gt;&amp;gt; data = &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;new&lt;/span&gt;&lt;span&gt; ArrayList&amp;lt;HashMap&amp;lt;String, Object&amp;gt;&amp;gt;();   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;for&lt;/span&gt;&lt;span&gt; (&lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;int&lt;/span&gt;&lt;span&gt; i = &lt;/span&gt;&lt;span class=&quot;number&quot;&gt;0&lt;/span&gt;&lt;span&gt;; i &amp;lt; menuNameArray.length; i++) {   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;            HashMap&amp;lt;String, Object&amp;gt; map = &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;new&lt;/span&gt;&lt;span&gt; HashMap&amp;lt;String, Object&amp;gt;();   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;            map.put(&lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;itemImage&quot;&lt;/span&gt;&lt;span&gt;, imageResourceArray[i]);   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;            map.put(&lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;itemText&quot;&lt;/span&gt;&lt;span&gt;, menuNameArray[i]);   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;            data.add(map);   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        }   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        SimpleAdapter simperAdapter = &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;new&lt;/span&gt;&lt;span&gt; SimpleAdapter(&lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;this&lt;/span&gt;&lt;span&gt;, data,   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;                R.layout.item_menu, &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;new&lt;/span&gt;&lt;span&gt; String[] { &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;itemImage&quot;&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;itemText&quot;&lt;/span&gt;&lt;span&gt; },   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;                &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;new&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;int&lt;/span&gt;&lt;span&gt;[] { R.id.item_image, R.id.item_text });   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;return&lt;/span&gt;&lt;span&gt; simperAdapter;   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;    }   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;annotation&quot;&gt;@Override&lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;    &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;public&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;boolean&lt;/span&gt;&lt;span&gt; onMenuOpened(&lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;int&lt;/span&gt;&lt;span&gt; featureId, Menu menu) {   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;if&lt;/span&gt;&lt;span&gt; (menuDialog == &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;null&lt;/span&gt;&lt;span&gt;) {   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;            menuDialog = &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;new&lt;/span&gt;&lt;span&gt; AlertDialog.Builder(&lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;this&lt;/span&gt;&lt;span&gt;).setView(menuView).show();   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        } &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;else&lt;/span&gt;&lt;span&gt; {   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;            menuDialog.show();   &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;        }   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;        &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;return&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;false&lt;/span&gt;&lt;span&gt;;&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;// 返回为true 则显示系统menu &lt;/span&gt;&lt;span&gt;  &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;    }   &lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;       &lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;alt&quot;&gt;&lt;span&gt;}  &lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;div&gt;原代码下载&lt;a title=&quot;源代码&quot; href=&quot;http://115.com/file/bhk8gqgo#&quot;&gt;点击这里&lt;/a&gt;&lt;br /&gt;
效果浏览&lt;/div&gt;
&lt;div&gt;&lt;img class=&quot;alignleft&quot; title=&quot;效果图&quot; src=&quot;http://www.chendw.cn/wp-content/uploads/auto_save_image/2011/12/0120171ER.png&quot; alt=&quot;&quot; width=&quot;329&quot; height=&quot;486&quot; /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;img class=&quot;alignright&quot; title=&quot;效果图&quot; src=&quot;http://www.chendw.cn/wp-content/uploads/auto_save_image/2011/12/012017GwJ.png&quot; alt=&quot;&quot; width=&quot;324&quot; height=&quot;484&quot; /&gt;&lt;/div&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/608513714/chendw/feedsky/s.gif?r=http://www.chendw.cn/programming/588.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</content:encoded><wfw:commentRss>http://www.chendw.cn/programming/588.html/feed</wfw:commentRss><slash:comments>0</slash:comments><description>　　菜单是用户界面中最常见的元素之一，使用非常频繁，在Android中，菜单被分为如下三种，选项菜单（OptionsMenu）、上下文菜单（ContextMenu）和子菜单（SubMenu），今天这讲是OptionsMenu&lt;br/&gt;
　　一、概述&lt;br/&gt;
　　public boolean onCreateOptionsMenu(Menu menu)：使用此方法调用OptionsMenu。&lt;br/&gt;
　　public boolean onOptionsItemSelected(MenuItem item)：选中菜单项后发生的动作。&lt;br/&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/608513714/chendw/feedsky/s.gif?r=http://www.chendw.cn/programming/588.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><category>编程技术</category><category>Android</category><category>Java</category><pubDate>Wed, 21 Dec 2011 09:20:16 +0800</pubDate><author>随风散忆</author><comments>http://www.chendw.cn/programming/588.html#comments</comments><guid isPermaLink="false">http://www.chendw.cn/?p=588</guid><dc:creator>随风散忆</dc:creator><fs:srclink>http://www.chendw.cn/programming/588.html</fs:srclink><fs:srcfeed>http://www.chendw.cn/feed</fs:srcfeed><fs:itemid>feedsky/chendw/~8582565/608513714/6687410</fs:itemid></item><item><title>linux下Nginx+tomcat整合的安装与配置[转]</title><link>http://www.chendw.cn/document/583.html</link><content:encoded>&lt;p&gt;&lt;strong&gt;目的：搭建Nginx与tomcat整合，用Nginx代替apache&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;一、安装Tomcat和JDK&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;二、安装Nginx&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;三、其他&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&lt;strong&gt;详细教程请移步：&lt;a href=&quot;http://www.jsprun.net/thread-16889-1-1.html&quot;&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;http://www.jsprun.net/thread-16889-1-1.html&lt;/span&gt;&lt;/a&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/608513715/chendw/feedsky/s.gif?r=http://www.chendw.cn/document/583.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</content:encoded><wfw:commentRss>http://www.chendw.cn/document/583.html/feed</wfw:commentRss><slash:comments>0</slash:comments><description>目的：搭建Nginx与tomcat整合，用Nginx代替apache

一、安装Tomcat和JDK

二、安装Nginx

三、其他&lt;img src=&quot;http://www1.feedsky.com/t1/608513715/chendw/feedsky/s.gif?r=http://www.chendw.cn/document/583.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><category>Linux</category><category>nginx</category><category>文档教程</category><category>Tomcat</category><pubDate>Tue, 20 Dec 2011 09:00:44 +0800</pubDate><author>随风散忆</author><comments>http://www.chendw.cn/document/583.html#comments</comments><guid isPermaLink="false">http://www.chendw.cn/?p=583</guid><dc:creator>随风散忆</dc:creator><fs:srclink>http://www.chendw.cn/document/583.html</fs:srclink><fs:srcfeed>http://www.chendw.cn/feed</fs:srcfeed><fs:itemid>feedsky/chendw/~8582565/608513715/6687410</fs:itemid></item><item><title>ORACLE数据库归档日志常用命令</title><link>http://www.chendw.cn/original/564.html</link><content:encoded>&lt;p&gt;&lt;span style=&quot;color: #000000;&quot;&gt;--连接恢复管理器&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;color: #000000;&quot;&gt;C:\Documents and Settings\mengzhaoliang&amp;gt;rman target/&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;color: #000000;&quot;&gt;--归档日志列表&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #000000;&quot;&gt;RMAN&amp;gt; list archivelog all;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;color: #000000;&quot;&gt;--删除物理文件不存在的归档日志&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #000000;&quot;&gt;RMAN&amp;gt; delete expired archivelog all;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;color: #000000;&quot;&gt;--删除7天前的归档日志&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #000000;&quot;&gt;RMAN&amp;gt; DELETE ARCHIVELOG ALL COMPLETED BEFORE 'SYSDATE-7';&lt;/span&gt;&lt;/p&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/608513716/chendw/feedsky/s.gif?r=http://www.chendw.cn/original/564.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</content:encoded><wfw:commentRss>http://www.chendw.cn/original/564.html/feed</wfw:commentRss><slash:comments>0</slash:comments><description>--连接恢复管理器

C:\Documents and Settings\mengzhaoliang&gt;rman target/

--归档日志列表
RMAN&gt; list archivelog all;

--删除物理文件不存在的归档日志
RMAN&gt; delete expired archivelog all;&lt;img src=&quot;http://www1.feedsky.com/t1/608513716/chendw/feedsky/s.gif?r=http://www.chendw.cn/original/564.html&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;</description><category>问题解决</category><category>Oracle</category><category>本站原创</category><pubDate>Fri, 16 Dec 2011 11:41:16 +0800</pubDate><author>随风散忆</author><comments>http://www.chendw.cn/original/564.html#comments</comments><guid isPermaLink="false">http://www.chendw.cn/?p=564</guid><dc:creator>随风散忆</dc:creator><fs:srclink>http://www.chendw.cn/original/564.html</fs:srclink><fs:srcfeed>http://www.chendw.cn/feed</fs:srcfeed><fs:itemid>feedsky/chendw/~8582565/608513716/6687410</fs:itemid></item></channel></rss>
