{"id":36469,"date":"2024-11-26T09:22:51","date_gmt":"2024-11-26T01:22:51","guid":{"rendered":"https:\/\/fwq.ai\/blog\/36469\/"},"modified":"2024-11-26T09:22:51","modified_gmt":"2024-11-26T01:22:51","slug":"%e5%a6%82%e4%bd%95%e9%81%bf%e5%85%8d-android-ui-%e7%ba%bf%e7%a8%8b%e9%98%bb%e5%a1%9e%e5%af%bc%e8%87%b4%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f%e5%8d%a1%e6%ad%bb%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/36469\/","title":{"rendered":"\u5982\u4f55\u907f\u514d Android UI \u7ebf\u7a0b\u963b\u585e\u5bfc\u81f4\u5e94\u7528\u7a0b\u5e8f\u5361\u6b7b\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173119968424803.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u907f\u514d Android UI \u7ebf\u7a0b\u963b\u585e\u5bfc\u81f4\u5e94\u7528\u7a0b\u5e8f\u5361\u6b7b\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u907f\u514d Android UI \u7ebf\u7a0b\u963b\u585e\u5bfc\u81f4\u5e94\u7528\u7a0b\u5e8f\u5361\u6b7b\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5b89\u5353 UI \u540c\u6b65\u7ebf\u7a0b\u963b\u585e\u89e3\u51b3\u65b9\u6848<\/strong><\/p>\n<p>\u5728 Android \u7f16\u7a0b\u4e2d\uff0cUI \u7ebf\u7a0b\u963b\u585e\u53ef\u80fd\u4f1a\u5bfc\u81f4\u5e94\u7528\u7a0b\u5e8f\u51fa\u73b0\u54cd\u5e94\u7f13\u6162\u6216\u5361\u6b7b\u7684\u95ee\u9898\u3002\u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e00\u95ee\u9898\uff0c\u5e94\u907f\u514d\u5728 UI \u7ebf\u7a0b\u4e2d\u6267\u884c\u8017\u65f6\u7684\u64cd\u4f5c\uff0c\u5982\u7f51\u7edc\u8bf7\u6c42\u3001\u6587\u4ef6\u8bfb\u53d6\u6216\u5ef6\u8fdf\u51fd\u6570\u3002<\/p>\n<p>\u5bf9\u4e8e\u63d0\u4f9b\u7684\u4ee3\u7801\u793a\u4f8b\uff0cbutton \u5355\u51fb\u4e8b\u4ef6\u4e2d\u8c03\u7528\u4e86 SendCommand.delay(4000)\uff0c\u8fd9\u662f\u4e00\u4e2a\u963b\u585e\u51fd\u6570\u3002\u8fd9\u610f\u5473\u7740 UI \u7ebf\u7a0b\u5c06\u5728 4 \u79d2\u5185\u88ab\u963b\u585e\uff0c\u671f\u95f4\u65e0\u6cd5\u5904\u7406\u5176\u4ed6\u4e8b\u4ef6\uff0c\u5305\u62ec\u66f4\u65b0 UI\u3002\u56e0\u6b64\uff0cState_ALL_ZERO.setText(&#8220;\u6b63\u5728\u8c03\u96f6&#8221;); \u4e0d\u4f1a\u7acb\u5373\u663e\u793a\uff0c\u800c\u662f\u5728 4 \u79d2\u540e\u624d\u663e\u793a\uff0c\u6b64\u65f6 State_ALL_ZERO.setText(&#8220;\u8c03\u96f6\u7ed3\u675f&#8221;); \u5df2\u7ecf\u6267\u884c\u5b8c\u6210\u3002<\/p>\n<p>\u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u53ef\u4ee5\u91c7\u7528\u4ee5\u4e0b\u65b9\u6cd5\uff1a<\/p>\n<ul>\n<li> <strong>\u4f7f\u7528\u5f02\u6b65\u4efb\u52a1\uff1a<\/strong>\u521b\u5efa\u5f02\u6b65\u4efb\u52a1\uff0c\u5728\u5176\u4e2d\u6267\u884c\u8017\u65f6\u64cd\u4f5c\uff0c\u5e76\u901a\u8fc7 onPostExecute() \u65b9\u6cd5\u56de\u8c03\u5728 UI \u7ebf\u7a0b\u4e2d\u66f4\u65b0 UI\u3002<\/li>\n<li> <strong>\u4f7f\u7528 Handler \u7ebf\u7a0b\uff1a<\/strong>\u521b\u5efa Handler \u7ebf\u7a0b\uff0c\u5e76\u5728\u5176\u4e2d\u6267\u884c\u8017\u65f6\u64cd\u4f5c\uff0c\u7136\u540e\u518d\u901a\u8fc7 sendMessage() \u65b9\u6cd5\u5411 UI \u7ebf\u7a0b\u53d1\u9001\u6d88\u606f\u6765\u66f4\u65b0 UI\u3002<\/li>\n<li> <strong>\u4f7f\u7528 RxJava \u6216 Kotlin Coroutines\uff1a<\/strong>\u8fd9\u4e9b\u5e93\u63d0\u4f9b\u4e86\u66f4\u9ad8\u7ea7\u7684\u5de5\u5177\uff0c\u53ef\u4ee5\u7075\u6d3b\u5730\u7ba1\u7406\u5f02\u6b65\u64cd\u4f5c\u548c\u907f\u514d UI \u7ebf\u7a0b\u963b\u585e\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u907f\u514d Android UI \u7ebf\u7a0b\u963b\u585e\u5bfc\u81f4\u5e94\u7528\u7a0b\u5e8f\u5361\u6b7b\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b89\u5353 UI \u540c\u6b65\u7ebf\u7a0b\u963b\u585e\u89e3\u51b3\u65b9\u6848 \u5728 Android \u7f16\u7a0b\u4e2d\uff0cUI \u7ebf\u7a0b\u963b\u585e\u53ef\u80fd\u4f1a\u5bfc\u81f4\u5e94\u7528\u7a0b\u5e8f\u51fa\u73b0\u54cd\u5e94\u7f13\u6162\u6216\u5361\u6b7b\u7684\u95ee\u9898\u3002\u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e00\u95ee\u9898\uff0c\u5e94\u907f\u514d\u5728 UI \u7ebf\u7a0b\u4e2d\u6267\u884c\u8017\u65f6\u7684\u64cd\u4f5c\uff0c\u5982\u7f51\u7edc\u8bf7\u6c42\u3001\u6587\u4ef6\u8bfb\u53d6\u6216\u5ef6\u8fdf\u51fd\u6570\u3002 \u5bf9\u4e8e\u63d0\u4f9b\u7684\u4ee3\u7801\u793a\u4f8b\uff0cbutton \u5355\u51fb\u4e8b\u4ef6\u4e2d\u8c03\u7528\u4e86 SendCommand.delay(4000)\uff0c\u8fd9\u662f\u4e00\u4e2a\u963b\u585e\u51fd\u6570\u3002\u8fd9\u610f\u5473\u7740 UI \u7ebf\u7a0b\u5c06\u5728 4 \u79d2\u5185\u88ab\u963b\u585e\uff0c\u671f\u95f4\u65e0\u6cd5\u5904\u7406\u5176\u4ed6\u4e8b\u4ef6\uff0c\u5305\u62ec\u66f4\u65b0 UI\u3002\u56e0\u6b64\uff0cState_ALL_ZERO.setText(&#8220;\u6b63\u5728\u8c03\u96f6&#8221;); \u4e0d\u4f1a\u7acb\u5373\u663e\u793a\uff0c\u800c\u662f\u5728 4 \u79d2\u540e\u624d\u663e\u793a\uff0c\u6b64\u65f6 State_ALL_ZERO.setText(&#8220;\u8c03\u96f6\u7ed3\u675f&#8221;); \u5df2\u7ecf\u6267\u884c\u5b8c\u6210\u3002 \u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u53ef\u4ee5\u91c7\u7528\u4ee5\u4e0b\u65b9\u6cd5\uff1a \u4f7f\u7528\u5f02\u6b65\u4efb\u52a1\uff1a\u521b\u5efa\u5f02\u6b65\u4efb\u52a1\uff0c\u5728\u5176\u4e2d\u6267\u884c\u8017\u65f6\u64cd\u4f5c\uff0c\u5e76\u901a\u8fc7 onPostExecute() \u65b9\u6cd5\u56de\u8c03\u5728 UI \u7ebf\u7a0b\u4e2d\u66f4\u65b0 UI\u3002 \u4f7f\u7528 Handler \u7ebf\u7a0b\uff1a\u521b\u5efa Handler \u7ebf\u7a0b\uff0c\u5e76\u5728\u5176\u4e2d\u6267\u884c\u8017\u65f6\u64cd\u4f5c\uff0c\u7136\u540e\u518d\u901a\u8fc7 sendMessage() \u65b9\u6cd5\u5411 UI \u7ebf\u7a0b\u53d1\u9001\u6d88\u606f\u6765\u66f4\u65b0 UI\u3002 \u4f7f\u7528 RxJava \u6216 Kotlin Coroutines\uff1a\u8fd9\u4e9b\u5e93\u63d0\u4f9b\u4e86\u66f4\u9ad8\u7ea7\u7684\u5de5\u5177\uff0c\u53ef\u4ee5\u7075\u6d3b\u5730\u7ba1\u7406\u5f02\u6b65\u64cd\u4f5c\u548c\u907f\u514d UI \u7ebf\u7a0b\u963b\u585e\u3002 \u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u907f\u514d Android UI \u7ebf\u7a0b\u963b\u585e\u5bfc\u81f4\u5e94\u7528\u7a0b\u5e8f\u5361\u6b7b\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-36469","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/36469","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=36469"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/36469\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=36469"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=36469"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=36469"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}