{"id":36514,"date":"2024-11-26T10:42:08","date_gmt":"2024-11-26T02:42:08","guid":{"rendered":"https:\/\/fwq.ai\/blog\/36514\/"},"modified":"2024-11-26T10:42:08","modified_gmt":"2024-11-26T02:42:08","slug":"android-ui-%e7%ba%bf%e7%a8%8b%e9%98%bb%e5%a1%9e%ef%bc%9a%e5%a6%82%e4%bd%95%e8%a7%a3%e5%86%b3%e6%ad%a3%e5%9c%a8%e8%b0%83%e9%9b%b6%e6%8f%90%e7%a4%ba%e6%97%a0%e6%b3%95%e6%98%be%e7%a4%ba","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/36514\/","title":{"rendered":"Android UI \u7ebf\u7a0b\u963b\u585e\uff1a\u5982\u4f55\u89e3\u51b3\u201c\u6b63\u5728\u8c03\u96f6\u201d\u63d0\u793a\u65e0\u6cd5\u663e\u793a\u7684\u95ee\u9898\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173128431989236.jpg\" class=\"aligncenter\" title=\"Android UI \u7ebf\u7a0b\u963b\u585e\uff1a\u5982\u4f55\u89e3\u51b3\u201c\u6b63\u5728\u8c03\u96f6\u201d\u63d0\u793a\u65e0\u6cd5\u663e\u793a\u7684\u95ee\u9898\uff1f\u63d2\u56fe\" alt=\"Android UI \u7ebf\u7a0b\u963b\u585e\uff1a\u5982\u4f55\u89e3\u51b3\u201c\u6b63\u5728\u8c03\u96f6\u201d\u63d0\u793a\u65e0\u6cd5\u663e\u793a\u7684\u95ee\u9898\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5b89\u5353ui\u540c\u6b65\u7ebf\u7a0b\u963b\u585e\u95ee\u9898<\/strong><\/p>\n<p>\u5728android\u5f00\u53d1\u4e2d\uff0cui\u7ebf\u7a0b\u7684\u963b\u585e\u95ee\u9898\u5e38\u89c1\u4e8e\u5728\u4e3b\u7ebf\u7a0b\u4e2d\u6267\u884c\u8017\u65f6\u64cd\u4f5c\u3002\u4f8b\u5982\uff0c\u5728\u4e3b\u7ebf\u7a0b\u4e2d\u6267\u884c\u5ef6\u8fdf\u64cd\u4f5c\uff08delay\uff09\u5c31\u4f1a\u5bfc\u81f4ui\u7ebf\u7a0b\u963b\u585e\uff0c\u5bfc\u81f4\u754c\u9762\u5931\u53bb\u54cd\u5e94\u3002<\/p>\n<p>\u95ee\u9898\u4e2d\u63d0\u4f9b\u7684\u4ee3\u7801\u793a\u4f8b\u4e2d\uff0cui\u7ebf\u7a0b\u6267\u884c\u4e86\u4e24\u4e2a4\u79d2\u7684\u5ef6\u8fdf\u64cd\u4f5c\uff0c\u5206\u522b\u662f\u5728\u201c\u6b63\u5728\u8c03\u96f6\u201d\u63d0\u793a\u663e\u793a\u524d\u548c\u201c\u8c03\u96f6\u7ed3\u675f\u201d\u63d0\u793a\u663e\u793a\u540e\u3002\u8fd9\u5bfc\u81f4\u4e86\u201c\u6b63\u5728\u8c03\u96f6\u201d\u63d0\u793a\u65e0\u6cd5\u663e\u793a\uff0c\u56e0\u4e3aui\u7ebf\u7a0b\u88ab\u7b2c\u4e00\u4e2a\u5ef6\u8fdf\u64cd\u4f5c\u963b\u585e\u4e86\u3002<\/p>\n<p>\u8981\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u9700\u8981\u5c06\u5ef6\u8fdf\u64cd\u4f5c\u79fb\u51faui\u7ebf\u7a0b\u3002\u53ef\u4ee5\u91c7\u7528\u4ee5\u4e0b\u65b9\u6cd5\u4e4b\u4e00\uff1a<\/p>\n<ul>\n<li> <strong>\u5355\u72ec\u5f00\u4e00\u4e2a\u7ebf\u7a0b\uff1a<\/strong>\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u7ebf\u7a0b\u6765\u6267\u884c\u5ef6\u8fdf\u64cd\u4f5c\uff0c\u4e0d\u4f1a\u963b\u585eui\u7ebf\u7a0b\u3002<\/li>\n<li> <strong>\u4f7f\u7528 sendmessagedelayed\uff1a<\/strong>\u4f7f\u7528 handler \u7684 sendmessagedelayed \u65b9\u6cd5\u53ef\u4ee5\u5c06\u6d88\u606f\u5ef6\u8fdf\u53d1\u9001\u5230ui\u7ebf\u7a0b\uff0c\u800c\u4e0d\u4f1a\u963b\u585eui\u7ebf\u7a0b\u3002\u8be5\u6d88\u606f\u53ef\u4ee5\u5728\u5904\u7406\u7a0b\u5e8f\u4e2d\u63a5\u6536\u5e76\u6267\u884c\u5ef6\u8fdf\u64cd\u4f5c\u3002<\/li>\n<\/ul>\n<p>\u4fee\u6539\u540e\u7684\u4ee3\u7801\u793a\u4f8b\u5982\u4e0b\uff1a<\/p>\n<pre>override fun onClick(view: View) {\n    if (view.id == R.id.BTN_O2_RESET) {\n        Log.i(\"onclick\", \"BTN_O2_N2\")\n        \/\/ \u63d0\u793a\u4fe1\u606f\n        State_ALL_ZERO.setText(\"\u6b63\u5728\u8c03\u96f6\")\n        State_ALL_ZERO.invalidate()\n        \/\/ \u4f7f\u7528 Handler \u5ef6\u8fdf\u6267\u884c\u53d1\u9001\u4e32\u53e3\u547d\u4ee4\n        Handler().postDelayed({\n            \/\/ \u8bed\u53e5\u4f53\uff0c\u6267\u884c\u53d1\u9001\u4e32\u53e3\u547d\u4ee4\n            \/\/ \u63d0\u793a\u4fe1\u606f\n            State_ALL_ZERO.setText(\"\u8c03\u96f6\u7ed3\u675f\")\n            State_ALL_ZERO.invalidate()\n        }, 4000)\n    }\n}<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fAndroid UI \u7ebf\u7a0b\u963b\u585e\uff1a\u5982\u4f55\u89e3\u51b3\u201c\u6b63\u5728\u8c03\u96f6\u201d\u63d0\u793a\u65e0\u6cd5\u663e\u793a\u7684\u95ee\u9898\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\u5353ui\u540c\u6b65\u7ebf\u7a0b\u963b\u585e\u95ee\u9898 \u5728android\u5f00\u53d1\u4e2d\uff0cui\u7ebf\u7a0b\u7684\u963b\u585e\u95ee\u9898\u5e38\u89c1\u4e8e\u5728\u4e3b\u7ebf\u7a0b\u4e2d\u6267\u884c\u8017\u65f6\u64cd\u4f5c\u3002\u4f8b\u5982\uff0c\u5728\u4e3b\u7ebf\u7a0b\u4e2d\u6267\u884c\u5ef6\u8fdf\u64cd\u4f5c\uff08delay\uff09\u5c31\u4f1a\u5bfc\u81f4ui\u7ebf\u7a0b\u963b\u585e\uff0c\u5bfc\u81f4\u754c\u9762\u5931\u53bb\u54cd\u5e94\u3002 \u95ee\u9898\u4e2d\u63d0\u4f9b\u7684\u4ee3\u7801\u793a\u4f8b\u4e2d\uff0cui\u7ebf\u7a0b\u6267\u884c\u4e86\u4e24\u4e2a4\u79d2\u7684\u5ef6\u8fdf\u64cd\u4f5c\uff0c\u5206\u522b\u662f\u5728\u201c\u6b63\u5728\u8c03\u96f6\u201d\u63d0\u793a\u663e\u793a\u524d\u548c\u201c\u8c03\u96f6\u7ed3\u675f\u201d\u63d0\u793a\u663e\u793a\u540e\u3002\u8fd9\u5bfc\u81f4\u4e86\u201c\u6b63\u5728\u8c03\u96f6\u201d\u63d0\u793a\u65e0\u6cd5\u663e\u793a\uff0c\u56e0\u4e3aui\u7ebf\u7a0b\u88ab\u7b2c\u4e00\u4e2a\u5ef6\u8fdf\u64cd\u4f5c\u963b\u585e\u4e86\u3002 \u8981\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u9700\u8981\u5c06\u5ef6\u8fdf\u64cd\u4f5c\u79fb\u51faui\u7ebf\u7a0b\u3002\u53ef\u4ee5\u91c7\u7528\u4ee5\u4e0b\u65b9\u6cd5\u4e4b\u4e00\uff1a \u5355\u72ec\u5f00\u4e00\u4e2a\u7ebf\u7a0b\uff1a\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u7ebf\u7a0b\u6765\u6267\u884c\u5ef6\u8fdf\u64cd\u4f5c\uff0c\u4e0d\u4f1a\u963b\u585eui\u7ebf\u7a0b\u3002 \u4f7f\u7528 sendmessagedelayed\uff1a\u4f7f\u7528 handler \u7684 sendmessagedelayed \u65b9\u6cd5\u53ef\u4ee5\u5c06\u6d88\u606f\u5ef6\u8fdf\u53d1\u9001\u5230ui\u7ebf\u7a0b\uff0c\u800c\u4e0d\u4f1a\u963b\u585eui\u7ebf\u7a0b\u3002\u8be5\u6d88\u606f\u53ef\u4ee5\u5728\u5904\u7406\u7a0b\u5e8f\u4e2d\u63a5\u6536\u5e76\u6267\u884c\u5ef6\u8fdf\u64cd\u4f5c\u3002 \u4fee\u6539\u540e\u7684\u4ee3\u7801\u793a\u4f8b\u5982\u4e0b\uff1a override fun onClick(view: View) { if (view.id == R.id.BTN_O2_RESET) { Log.i(&#8220;onclick&#8221;, &#8220;BTN_O2_N2&#8221;) \/\/ \u63d0\u793a\u4fe1\u606f State_ALL_ZERO.setText(&#8220;\u6b63\u5728\u8c03\u96f6&#8221;) State_ALL_ZERO.invalidate() \/\/ \u4f7f\u7528 Handler \u5ef6\u8fdf\u6267\u884c\u53d1\u9001\u4e32\u53e3\u547d\u4ee4 Handler().postDelayed({ \/\/ \u8bed\u53e5\u4f53\uff0c\u6267\u884c\u53d1\u9001\u4e32\u53e3\u547d\u4ee4 \/\/ \u63d0\u793a\u4fe1\u606f State_ALL_ZERO.setText(&#8220;\u8c03\u96f6\u7ed3\u675f&#8221;) State_ALL_ZERO.invalidate() }, 4000) } } \u767b\u5f55\u540e\u590d\u5236 \u4ee5\u4e0a\u5c31\u662fAndroid UI \u7ebf\u7a0b\u963b\u585e\uff1a\u5982\u4f55\u89e3\u51b3\u201c\u6b63\u5728\u8c03\u96f6\u201d\u63d0\u793a\u65e0\u6cd5\u663e\u793a\u7684\u95ee\u9898\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-36514","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/36514","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=36514"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/36514\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=36514"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=36514"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=36514"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}