{"id":549,"date":"2015-04-21T20:13:17","date_gmt":"2015-04-21T12:13:17","guid":{"rendered":"https:\/\/ai.zhousir.top\/?p=549"},"modified":"2026-08-18T12:58:41","modified_gmt":"2026-08-18T04:58:41","slug":"android%e6%8e%a7%e4%bb%b6%e4%bb%8b%e7%bb%8d","status":"publish","type":"post","link":"https:\/\/ai.zhousir.top\/?p=549","title":{"rendered":"Android\u63a7\u4ef6\u4ecb\u7ecd"},"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;\"><strong>TextView<\/strong> \u662f\u6700\u5e38\u89c1\u7684\u63a7\u4ef6\uff0c\u7528\u6765\u663e\u793a\u6587\u672c\uff1a\u5728 layout \u91cc\u63d2\u5165\u63a7\u4ef6\u3001\u8bbe id\uff0cActivity \u91cc\u5c31\u80fd\u62ff\u5230\u5b83\u5e76\u6539\u663e\u793a\u5185\u5bb9\u3002\u5176\u5b83\u6309\u94ae\u3001\u5217\u8868\u3001\u56fe\u7247\u3001\u6eda\u52a8\u3001\u8f93\u5165\u6846\uff0c\u5957\u8def\u90fd\u5dee\u4e0d\u591a\u2014\u2014\u5e03\u5c40\u91cc\u653e\u597d\uff0c\u4ee3\u7801\u91cc\u6309 id \u53d6\uff0c\u9700\u8981\u65f6\u518d\u6302\u76d1\u542c\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\u5e38\u7528\u63a7\u4ef6\u5404\u5e72\u4ec0\u4e48<\/span><\/h2>\n<ul style=\"padding-left: 1rem; margin-left: 1rem; font-size: 0.9rem; list-style-type: disc;\">\n<li>\n<section><strong>Button<\/strong>\uff1a\u5e03\u5c40\u91cc\u62d6\u4e00\u4e2a\u6309\u94ae\uff0c\u4ee3\u7801\u91cc\u901a\u8fc7 id \u83b7\u53d6\u3002\u901a\u5e38\u4f1a\u5199\u76d1\u542c\u5668\uff0c\u6309\u4e0b\u540e\u8df3\u8f6c\u754c\u9762\u6216\u5f39\u51fa\u4fe1\u606f\u3002<\/section>\n<\/li>\n<li>\n<section><strong>TabHost<\/strong>\uff1aAndroid 4.0 \u4e4b\u524d\u5e38\u7528\uff0c\u5728\u4e00\u4e2a Activity \u91cc\u5207\u6362\u591a\u5757\u5185\u5bb9\u3002\u8f83\u65b0\u7684\u505a\u6cd5\u662f Fragment + ViewPager \u505a\u6ed1\u52a8\u5206\u9875\u3002<\/section>\n<\/li>\n<li>\n<section><strong>ListView<\/strong>\uff1a\u628a\u6570\u636e\u505a\u6210\u5217\u8868\u663e\u793a\uff0c\u5e38\u89c1\u4e8e\u6587\u7ae0\u6807\u9898\u3001\u8054\u7cfb\u4eba\u3001\u5546\u54c1\u4fe1\u606f\u3002<\/section>\n<\/li>\n<li>\n<section><strong>ImageView<\/strong>\uff1a\u63d2\u5165\u56fe\u7247\uff0c\u7ed9\u754c\u9762\u52a0\u89c6\u89c9\u5c42\u6b21\u3002<\/section>\n<\/li>\n<li>\n<section><strong>ScrollView<\/strong>\uff1a\u5185\u5bb9\u8d85\u51fa\u5c4f\u5e55\u65f6\u6eda\u52a8\u663e\u793a\uff0c\u597d\u7528\u4e5f\u597d\u4e0a\u624b\u3002<\/section>\n<\/li>\n<li>\n<section><strong>EditText<\/strong>\uff08\u539f\u6587\u5199\u4f5c EditView\uff09\uff1a\u8f93\u5165\u6587\u672c\uff0c\u7528\u6765\u6536\u96c6\u7528\u6237\u8f93\u5165\u3002<\/section>\n<\/li>\n<\/ul>\n<p style=\"margin: 1em 0px;\">\u6b64\u5916\u8fd8\u6709 ViewPager\u3001RadioButton\u3001ImageButton\u3001Spinner\u3001GridView \u7b49\uff0c\u719f\u6089\u4e4b\u540e\u624d\u5bb9\u6613\u505a\u51fa\u9884\u671f\u4e2d\u7684\u4ea7\u54c1\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;\">\u63a7\u4ef6<\/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;\">\u5178\u578b\u7528\u9014<\/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;\">\u4f7f\u7528\u8981\u70b9<\/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;\">TextView<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u663e\u793a\u6587\u672c<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u5e03\u5c40\u8bbe id\uff0cActivity \u91cc\u6539\u6587\u6848<\/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;\">Button<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u89e6\u53d1\u64cd\u4f5c<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u5199 OnClickListener\uff1a\u8df3\u8f6c\u6216\u5f39\u7a97<\/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;\">TabHost<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u540c\u4e00 Activity \u591a\u9875\u7b7e<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">4.0 \u524d\u5e38\u7528\uff1b\u4e4b\u540e\u770b Fragment \/ ViewPager<\/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;\">ListView<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u5217\u8868\u6570\u636e<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u6807\u9898\u3001\u8054\u7cfb\u4eba\u3001\u5546\u54c1\u6761\u76ee<\/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;\">ImageView<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u5c55\u793a\u56fe\u7247<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u88c5\u9970\u4e0e\u5185\u5bb9\u56fe<\/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;\">ScrollView<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u5185\u5bb9\u8d85\u51fa\u5c4f\u5e55<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u5305\u4e00\u5c42\u5373\u53ef\u6eda\u52a8<\/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;\">EditText<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u7528\u6237\u8f93\u5165<\/td>\n<td style=\"font-size: 0.75em; padding: 9px 12px; line-height: 22px; border: 1px solid #ef7060; vertical-align: top;\">\u53d6 getText() \u518d\u6821\u9a8c<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\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\u9700\u8981\u638c\u63e1\u7684\u63a7\u4ef6\u4e00\u89c8<\/span><\/h2>\n<p style=\"margin: 1em 0px;\">\u4f60\u9700\u8981\u638c\u63e1\u7684\u63a7\u4ef6\u5982\u4e0b\u56fe\uff1a<\/p>\n<p style=\"margin: 1em 0px;\"><a href=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2015\/04\/kongjian.png\" rel=\"fancybox\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-550\" src=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2015\/04\/kongjian.png\" alt=\"kongjian\" width=\"390\" height=\"497\" srcset=\"https:\/\/ai.zhousir.top\/wp-content\/uploads\/2015\/04\/kongjian.png 390w, https:\/\/ai.zhousir.top\/wp-content\/uploads\/2015\/04\/kongjian-235x300.png 235w\" sizes=\"(max-width: 390px) 100vw, 390px\" \/><\/a><\/p>\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\uff1a\u63a7\u4ef6\u7528\u6cd5\u9ad8\u5ea6\u540c\u6784\u2014\u2014XML \u91cc\u653e\u3001id \u53d6\u51fa\u6765\u3001\u5fc5\u8981\u65f6\u6302\u76d1\u542c\uff1b\u5148\u628a TextView \/ Button \/ ListView \/ ImageView \/ ScrollView \/ EditText \u7ec3\u719f\uff0c\u518d\u6269\u5230 ViewPager \u548c\u9009\u62e9\u7c7b\u63a7\u4ef6\u3002<\/strong><\/p>\n<\/blockquote>\n<\/section>\n","protected":false},"excerpt":{"rendered":"<p>TextView \u662f\u6700\u5e38\u89c1\u7684\u63a7\u4ef6\uff0c\u7528\u6765\u663e\u793a\u6587\u672c\uff1a\u5728 layout \u91cc\u63d2\u5165\u63a7\u4ef6\u3001\u8bbe id\uff0cActivity \u91cc\u5c31 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[195],"_links":{"self":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/549"}],"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=549"}],"version-history":[{"count":3,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/549\/revisions"}],"predecessor-version":[{"id":553,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/549\/revisions\/553"}],"wp:attachment":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=549"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=549"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=549"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}