{"id":532,"date":"2015-04-21T19:20:12","date_gmt":"2015-04-21T11:20:12","guid":{"rendered":"https:\/\/ai.zhousir.top\/?p=532"},"modified":"2026-08-18T12:58:40","modified_gmt":"2026-08-18T04:58:40","slug":"activity%e6%b4%bb%e5%8a%a8%e6%a6%82%e8%bf%b0","status":"publish","type":"post","link":"https:\/\/ai.zhousir.top\/?p=532","title":{"rendered":"Activity\u6d3b\u52a8\u6982\u8ff0"},"content":{"rendered":"<section id=\"wenyan\" style=\"font-family: system-ui, 'Apple Color Emoji', 'Segoe UI', 'Segoe UI Symbol', 'Noto Sans', Roboto, sans-serif; line-height: 1.75; font-size: 16px; color: #000000; caret-color: #000000;\" data-provider=\"WenYan\">\n<blockquote style=\"margin: 20px 0px; display: block; font-size: 0.9em; overflow: auto; border-left: 3px solid #ef7060; color: #6a737d; padding: 10px 10px 10px 20px; background: #fff9f9;\">\n<p style=\"margin: 1em 0px;\">\u5b98\u65b9\u8bf4\u6cd5\uff1a\u4e00\u4e2a <strong>Activity<\/strong> \u662f\u5e94\u7528\u7a0b\u5e8f\u7ec4\u4ef6\uff0c\u63d0\u4f9b\u4e00\u5757\u5c4f\u5e55\u8ba9\u7528\u6237\u5b8c\u6210\u4efb\u52a1\u2014\u2014\u62e8\u53f7\u3001\u62cd\u7167\u3001\u53d1\u90ae\u4ef6\u3001\u770b\u5730\u56fe\u3002\u6bcf\u4e2a Activity \u5206\u5230\u4e00\u4e2a\u7a97\u53e3\u6765\u753b\u754c\u9762\uff1b\u7a97\u53e3\u901a\u5e38\u94fa\u6ee1\u5c4f\u5e55\uff0c\u4e5f\u53ef\u4ee5\u66f4\u5c0f\u3001\u6d6e\u5728\u522b\u7684\u7a97\u53e3\u4e0a\u3002<\/p>\n<\/blockquote>\n<p><!--more--><\/p>\n<hr>\n<h2 style=\"margin: 1.2em 0px 1em; padding: 0px; font-weight: bold; font-size: 1.3em; border-bottom: 2px solid #ef7060; display: flex;\"><span style=\"display: inline-block; font-weight: bold; background: #ef7060; color: #ffffff; padding: 3px 10px 1px; border-top-right-radius: 3px; border-top-left-radius: 3px; margin-right: 3px;\">\u4e00\u3001\u591a\u4e2a Activity \u4e0e\u8fd4\u56de\u6808<\/span><\/h2>\n<p style=\"margin: 1em 0px;\">\u4e00\u4e2a\u5e94\u7528\u901a\u5e38\u7531\u591a\u4e2a\u677e\u8026\u5408\u7684 Activity \u7ec4\u6210\u3002\u5176\u4e2d\u4f1a\u6307\u5b9a\u4e00\u4e2a <strong>main<\/strong> Activity\uff0c\u7b2c\u4e00\u6b21\u542f\u52a8\u65f6\u5448\u73b0\u7ed9\u7528\u6237\u3002\u4e4b\u540e\u6bcf\u4e2a Activity \u90fd\u53ef\u4ee5\u518d\u542f\u52a8\u53e6\u4e00\u4e2a\uff0c\u53bb\u5b8c\u6210\u4e0d\u540c\u52a8\u4f5c\u3002<\/p>\n<p style=\"margin: 1em 0px;\">\u6bcf\u6b21\u542f\u52a8\u65b0 Activity\uff0c\u524d\u4e00\u4e2a\u5c31\u505c\u6b62\uff0c\u4f46\u7cfb\u7edf\u628a\u5b83\u7559\u5728\u6808\u4e0a\uff08<strong>back stack<\/strong>\uff09\u3002\u65b0 Activity \u5165\u6808\u9876\u3001\u62ff\u5230\u7126\u70b9\u3002\u6808\u662f\u540e\u8fdb\u5148\u51fa\uff1a\u7528\u6237\u70b9 Back\uff0c\u5f53\u524d Activity \u51fa\u6808\u5e76\u9500\u6bc1\uff0c\u524d\u4e00\u4e2a\u6062\u590d\u3002<\/p>\n<p style=\"margin: 1em 0px;\">\u56e0\u65b0 Activity \u542f\u52a8\u800c\u505c\u6b62\u65f6\uff0c\u7cfb\u7edf\u901a\u8fc7<strong>\u751f\u547d\u5468\u671f\u56de\u8c03<\/strong>\u901a\u77e5\u72b6\u6001\u53d8\u5316\u2014\u2014\u521b\u5efa\u3001\u505c\u6b62\u3001\u6062\u590d\u3001\u9500\u6bc1\u5404\u6709\u5bf9\u5e94\u65b9\u6cd5\u3002\u4f8b\u5982\u505c\u6b62\u65f6\u5e94\u91ca\u653e\u5927\u5bf9\u8c61\uff08\u7f51\u7edc\u3001\u6570\u636e\u5e93\u8fde\u63a5\uff09\uff1b\u6062\u590d\u65f6\u518d\u62ff\u56de\u8d44\u6e90\u3001\u63a5\u4e0a\u88ab\u6253\u65ad\u7684\u52a8\u4f5c\u3002\u8fd9\u4e9b\u8f6c\u6362\u5c31\u662f Activity \u751f\u547d\u5468\u671f\u7684\u4e00\u90e8\u5206\u3002<\/p>\n<hr>\n<h2 style=\"margin: 1.2em 0px 1em; padding: 0px; font-weight: bold; font-size: 1.3em; border-bottom: 2px solid #ef7060; display: flex;\"><span style=\"display: inline-block; font-weight: bold; background: #ef7060; color: #ffffff; padding: 3px 10px 1px; border-top-right-radius: 3px; border-top-left-radius: 3px; margin-right: 3px;\">\u4e8c\u3001\u56db\u5927\u7ec4\u4ef6\u91cc\u7684\u63a7\u5236\u5668\uff0c\u4e0d\u662f\u300c\u53ea\u8d1f\u8d23\u663e\u793a\u300d<\/span><\/h2>\n<p style=\"margin: 1em 0px;\">Activity \u662f Android \u56db\u5927\u7ec4\u4ef6\u4e4b\u4e00\uff0c\u786e\u5b9e\u53ef\u4ee5\u663e\u793a View\uff0c\u4e5f\u51e0\u4e4e\u90fd\u548c\u7528\u6237\u4ea4\u4e92\u3002\u4f46\u4e0d\u80fd\u56e0\u6b64\u8bf4\u5b83\u300c\u4e3b\u8981\u5c31\u662f\u7528\u6765\u663e\u793a View\u300d\u2014\u2014\u663e\u793a\u53ea\u662f\u5b83\u80fd\u505a\u7684\u4e8b\u4e4b\u4e00\u3002<\/p>\n<p style=\"margin: 1em 0px;\">\u5bf9\u7167 MVC \u66f4\u6e05\u695a\u3002JavaEE \u91cc\u5206\u5c42\u5f88\u5e72\u51c0\uff1bAndroid \u91cc\u53ef\u4ee5\u8fd9\u6837\u5bf9\u5e94\uff1a<\/p>\n<ul style=\"padding-left: 1rem; margin-left: 1rem; font-size: 0.9rem; list-style-type: disc;\">\n<li>\n<section><strong>M\uff08Model\uff09<\/strong>\uff1a\u4e1a\u52a1\u4e3b\u4f53\u3002\u6570\u636e\u5e93\u3001\u7f51\u7edc\u7b49\u653e\u8fd9\u4e00\u5c42\uff08\u4e0d\u5fc5\u585e\u8fdb\u540c\u4e00\u4e2a\u5305\uff0c\u4f46\u7edf\u79f0 Model\uff09\u3002<\/section>\n<\/li>\n<li>\n<section><strong>V\uff08View\uff09<\/strong>\uff1a\u751f\u6210\u7528\u6237\u754c\u9762\u3001\u63a5\u6536\u8f93\u5165\u3001\u5c55\u793a\u7ed3\u679c\u3002Android \u91cc\u901a\u5e38\u7528 XML \u63cf\u8ff0\u754c\u9762\uff0c\u9700\u8981\u65f6\u518d inflate\uff1b\u4e5f\u53ef\u4ee5\u7528 JavaScript + HTML \u7b49\u5f53 View\u3002<\/section>\n<\/li>\n<li>\n<section><strong>C\uff08Controller\uff09<\/strong>\uff1a\u63a7\u5236\u5c42\u4e3b\u8981\u843d\u5728\u4f17\u591a Activity \u80a9\u4e0a\u3002\u4e0d\u8981\u5728 Activity \u91cc\u5806\u592a\u591a\u4ee3\u7801\uff0c\u5c3d\u91cf\u628a\u4e1a\u52a1\u4ea4\u7ed9 Model\u3002<\/section>\n<\/li>\n<\/ul>\n<p style=\"margin: 1em 0px;\">\u6240\u4ee5 Activity \u66f4\u50cf\u63a7\u5236\u5668\uff1a\u9009\u8981\u663e\u793a\u54ea\u5757 View\uff0c\u4ece View \u53d6\u6570\u636e\u4ea4\u7ed9 Model\uff0c\u518d\u628a\u5904\u7406\u7ed3\u679c\u5c55\u793a\u56de\u53bb\u3002<\/p>\n<table style=\"border-collapse: collapse; margin: 1.4em auto; max-width: 100%; table-layout: fixed; text-align: left; overflow: auto; display: table; overflow-wrap: break-word; word-break: break-all;\" width=\"817\">\n<thead>\n<tr>\n<th style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top; font-weight: bold; background-color: #fff9f9; color: #ef7060;\">\u5c42\u9762<\/th>\n<th style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top; font-weight: bold; background-color: #fff9f9; color: #ef7060;\">\u5728 Android \u91cc\u8c01\u6765\u5f53<\/th>\n<th style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top; font-weight: bold; background-color: #fff9f9; color: #ef7060;\">\u4e0d\u8be5\u585e\u4ec0\u4e48<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">Model<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u4e1a\u52a1\u3001\u7f51\u7edc\u3001\u6570\u636e\u5e93<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u4e0d\u8981\u548c Activity \u7ed1\u6b7b\u5728\u540c\u4e00\u5806\u65b9\u6cd5\u91cc<\/td>\n<\/tr>\n<tr>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">View<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u5e03\u5c40 XML \/ \u754c\u9762\u6811<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u4e0d\u8981\u5728 XML \u91cc\u5199\u4e1a\u52a1\u903b\u8f91<\/td>\n<\/tr>\n<tr>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">Controller<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">Activity<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u4e0d\u8981\u5199\u6210\u300c\u5de8\u578b God Activity\u300d<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<blockquote style=\"margin: 20px 0px; display: block; font-size: 0.9em; overflow: auto; border-left: 3px solid #ef7060; color: #6a737d; padding: 10px 10px 10px 20px; background: #fff9f9;\">\n<p style=\"margin: 1em 0px;\"><strong>\u4e00\u53e5\u8bdd\u603b\u7ed3\uff1aActivity \u662f\u5e26\u7a97\u53e3\u7684\u4ea4\u4e92\u7ec4\u4ef6\uff0c\u9760\u8fd4\u56de\u6808\u5207\u6362\uff1b\u5728 MVC \u91cc\u5b83\u662f\u63a7\u5236\u5668\uff0c\u8d1f\u8d23\u9009 View\u3001\u4f20\u6570\u636e\uff0c\u800c\u4e0d\u662f\u628a\u5168\u90e8\u4e1a\u52a1\u5199\u5728\u754c\u9762\u7c7b\u91cc\u3002<\/strong><\/p>\n<\/blockquote>\n<\/section>\n","protected":false},"excerpt":{"rendered":"<p>\u5b98\u65b9\u8bf4\u6cd5\uff1a\u4e00\u4e2a Activity \u662f\u5e94\u7528\u7a0b\u5e8f\u7ec4\u4ef6\uff0c\u63d0\u4f9b\u4e00\u5757\u5c4f\u5e55\u8ba9\u7528\u6237\u5b8c\u6210\u4efb\u52a1\u2014\u2014\u62e8\u53f7\u3001\u62cd\u7167\u3001\u53d1\u90ae\u4ef6\u3001\u770b\u5730\u56fe\u3002\u6bcf [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[6],"tags":[195],"_links":{"self":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/532"}],"collection":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=532"}],"version-history":[{"count":1,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/532\/revisions"}],"predecessor-version":[{"id":533,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/532\/revisions\/533"}],"wp:attachment":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=532"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=532"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=532"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}