{"id":212006,"date":"2021-03-04T08:28:40","date_gmt":"2021-03-04T00:28:40","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=212006"},"modified":"2021-02-24T11:29:32","modified_gmt":"2021-02-24T03:29:32","slug":"linux-arm-ui","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/linux-arm-ui.html","title":{"rendered":"\u4e3a Linux ARM \u8bbe\u5907\u6784\u5efa\u8de8\u5e73\u53f0 UI \u7684\u65b0\u65b9\u6cd5"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\nAndroidXML \u548c TotalCross \u7684\u8fd0\u7528\u4e3a\u6811\u8393\u6d3e\u548c\u5176\u4ed6\u8bbe\u5907\u521b\u5efa UI \u63d0\u4f9b\u4e86\u66f4\u7b80\u5355\u7684\u65b9\u6cd5\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\"\"<\/p>\n

\u4e3a\u5e94\u7528\u7a0b\u5e8f\u521b\u5efa\u826f\u597d\u7684\u7528\u6237\u4f53\u9a8c\uff08UX\uff09\u662f\u4e00\u9879\u8270\u5de8\u7684\u4efb\u52a1\uff0c\u5c24\u5176\u662f\u5728\u5f00\u53d1\u5d4c\u5165\u5f0f\u5e94\u7528\u7a0b\u5e8f\u65f6\u3002\u4eca\u5929\uff0c\u6709\u4e24\u79cd\u56fe\u5f62\u7528\u6237\u754c\u9762\uff08GUI\uff09\u5de5\u5177\u901a\u5e38\u7528\u4e8e\u5f00\u53d1\u5d4c\u5165\u5f0f\u8f6f\u4ef6\uff1a\u5b83\u4eec\u8981\u4e48\u6d89\u53ca\u590d\u6742\u7684\u6280\u672f\uff0c\u8981\u4e48\u975e\u5e38\u6602\u8d35\u3002<\/p>\n

\u7136\u800c\uff0c\u6211\u4eec\u5df2\u7ecf\u521b\u5efa\u4e86\u4e00\u4e2a\u6982\u5ff5\u9a8c\u8bc1\uff08PoC\uff09\uff0c\u5b83\u63d0\u4f9b\u4e86\u4e00\u79cd\u65b0\u7684\u65b9\u6cd5\u6765\u4f7f\u7528\u73b0\u6709\u7684\u3001\u6210\u719f\u7684\u5de5\u5177\u4e3a\u8fd0\u884c\u5728\u684c\u9762\u3001\u79fb\u52a8\u3001\u5d4c\u5165\u5f0f\u8bbe\u5907\u548c\u4f4e\u529f\u8017 ARM \u8bbe\u5907\u4e0a\u7684\u5e94\u7528\u7a0b\u5e8f\u6784\u5efa\u7528\u6237\u754c\u9762\uff08UI\uff09\u3002\u6211\u4eec\u7684\u65b9\u6cd5\u662f\u4f7f\u7528 Android Studio \u7ed8\u5236 UI\uff1b\u4f7f\u7528 TotalCross \u5728\u8bbe\u5907\u4e0a\u5448\u73b0 Android XML\uff1b\u91c7\u7528\u88ab\u79f0\u4e3a KnowCode \u7684\u65b0 TotalCross API\uff1b\u4ee5\u53ca\u4f7f\u7528 \u6811\u8393\u6d3e 4 \u6765\u6267\u884c\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n

\u9009\u62e9 Android Studio<\/strong><\/div>\n

\u53ef\u4ee5\u4f7f\u7528 TotalCross API \u4e3a\u5e94\u7528\u7a0b\u5e8f\u6784\u5efa\u4e00\u4e2a\u7f8e\u89c2\u7684\u54cd\u5e94\u5f0f\u7528\u6237\u4f53\u9a8c\uff0c\u4f46\u662f\u5728 Android Studio \u4e2d\u521b\u5efa UI \u7f29\u77ed\u4e86\u5236\u4f5c\u539f\u578b\u548c\u5b9e\u9645\u5e94\u7528\u7a0b\u5e8f\u4e4b\u95f4\u7684\u65f6\u95f4\u3002<\/p>\n

\u6709\u5f88\u591a\u5de5\u5177\u53ef\u4ee5\u7528\u6765\u4e3a\u5e94\u7528\u7a0b\u5e8f\u6784\u5efa UI\uff0c\u4f46\u662f Android Studio \u662f\u5168\u4e16\u754c\u5f00\u53d1\u8005\u6700\u5e38\u4f7f\u7528\u7684\u5de5\u5177\u3002\u9664\u4e86\u5b83\u88ab\u5927\u91cf\u91c7\u7528\u4ee5\u5916\uff0c\u8fd9\u4e2a\u5de5\u5177\u7684\u4f7f\u7528\u4e5f\u975e\u5e38\u76f4\u89c2\uff0c\u800c\u4e14\u5b83\u5bf9\u4e8e\u521b\u5efa\u7b80\u5355\u548c\u590d\u6742\u7684\u5e94\u7528\u7a0b\u5e8f\u90fd\u975e\u5e38\u5f3a\u5927\u3002\u5728\u6211\u770b\u6765\uff0c\u552f\u4e00\u7684\u7f3a\u70b9\u662f\u4f7f\u7528\u8be5\u5de5\u5177\u6240\u9700\u7684\u8ba1\u7b97\u673a\u6027\u80fd\uff0c\u5b83\u6bd4\u5176\u4ed6\u96c6\u6210\u5f00\u53d1\u73af\u5883 \uff08IDE\uff09 \u5982 VSCode \u6216\u5176\u5f00\u6e90\u66ff\u4ee3\u65b9\u6848 VSCodium \u8981\u5e9e\u5927\u5f97\u591a\u3002<\/p>\n

\u901a\u8fc7\u601d\u8003\u8fd9\u4e9b\u95ee\u9898\uff0c\u6211\u4eec\u521b\u5efa\u4e86\u4e00\u4e2a\u6982\u5ff5\u9a8c\u8bc1\uff0c\u4f7f\u7528 Android Studio \u7ed8\u5236 UI\uff0c\u5e76\u4f7f\u7528 TotalCross \u76f4\u63a5\u5728\u8bbe\u5907\u4e0a\u8fd0\u884c AndroidXML\u3002<\/p>\n

\u6784\u5efa UI<\/strong><\/div>\n

\u5bf9\u4e8e\u6211\u4eec\u7684 PoC\uff0c\u6211\u4eec\u60f3\u521b\u5efa\u4e00\u4e2a\u5bb6\u7528\u7535\u5668\u5e94\u7528\u7a0b\u5e8f\u6765\u63a7\u5236\u6e29\u5ea6\u548c\u5176\u4ed6\u4e1c\u897f\uff0c\u5e76\u5728 Linux ARM \u8bbe\u5907\u4e0a\u8fd0\u884c\u3002<\/p>\n

\u6211\u4eec\u60f3\u4e3a\u6811\u8393\u6d3e\u5f00\u53d1\u6211\u4eec\u7684\u5e94\u7528\u7a0b\u5e8f\uff0c\u6240\u4ee5\u6211\u4eec\u4f7f\u7528 Android \u7684 ConstraintLayout \u6765\u6784\u5efa 848x480\uff08\u6811\u8393\u6d3e\u7684\u5206\u8fa8\u7387\uff09\u7684\u56fa\u5b9a\u5c4f\u5e55\u5927\u5c0f\u7684 UI\uff0c\u4e0d\u8fc7\u4f60\u53ef\u4ee5\u7528\u5176\u4ed6\u5e03\u5c40\u6784\u5efa\u54cd\u5e94\u6027 UI\u3002<\/p>\n

Android XML \u4e3a UI \u521b\u5efa\u589e\u52a0\u4e86\u5f88\u591a\u7075\u6d3b\u6027\uff0c\u4f7f\u5f97\u4e3a\u5e94\u7528\u7a0b\u5e8f\u6784\u5efa\u4e30\u5bcc\u7684\u7528\u6237\u4f53\u9a8c\u53d8\u5f97\u5bb9\u6613\u3002\u5728\u4e0b\u9762\u7684 XML \u4e2d\uff0c\u6211\u4eec\u4f7f\u7528\u4e86\u4e24\u4e2a\u4e3b\u8981\u7ec4\u4ef6\uff1aImageView \u548c TextView\u3002
\n\"\"<\/p>\n

extView \u5143\u7d20\u7528\u4e8e\u5411\u7528\u6237\u663e\u793a\u4e00\u4e9b\u6570\u636e\uff0c\u6bd4\u5982\u5efa\u7b51\u7269\u5185\u7684\u6e29\u5ea6\u3002\u5927\u591a\u6570 ImageView \u90fd\u7528\u4f5c\u7528\u6237\u4e0e UI \u4ea4\u4e92\u7684\u6309\u94ae\uff0c\u4f46\u5b83\u4eec\u4e5f\u9700\u8981\u5b9e\u73b0\u5c4f\u5e55\u4e0a\u7ec4\u4ef6\u63d0\u4f9b\u7684\u4e8b\u4ef6\u3002<\/p>\n

\u7528 TotalCross \u6574\u5408<\/strong><\/div>\n

\u8fd9\u4e2a PoC \u4e2d\u7684\u7b2c\u4e8c\u9879\u6280\u672f\u662f TotalCross\u3002\u6211\u4eec\u4e0d\u60f3\u5728\u8bbe\u5907\u4e0a\u4f7f\u7528 Android \u7684\u4efb\u4f55\u4e1c\u897f\uff0c\u56e0\u4e3a\uff1a<\/p>\n

1\u3002\u6211\u4eec\u7684\u76ee\u6807\u662f\u4e3a Linux ARM \u63d0\u4f9b\u4e00\u4e2a\u51fa\u8272\u7684 UI\u3002 2\u3002\u6211\u4eec\u5e0c\u671b\u5728\u8bbe\u5907\u4e0a\u5b9e\u73b0\u4f4e\u5360\u7528\u3002 3\u3002\u6211\u4eec\u5e0c\u671b\u5e94\u7528\u7a0b\u5e8f\u5728\u4f4e\u8ba1\u7b97\u80fd\u529b\u7684\u4f4e\u7aef\u786c\u4ef6\u8bbe\u5907\u4e0a\u8fd0\u884c\uff08\u4f8b\u5982\uff0c\u6ca1\u6709 GPU\u3001 \u4f4e RAM \u7b49\uff09\u3002<\/p>\n

\u9996\u5148\uff0c\u6211\u4eec\u4f7f\u7528 VSCode \u63d2\u4ef6 \u521b\u5efa\u4e86\u4e00\u4e2a\u7a7a\u7684 TotalCross \u9879\u76ee\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u4fdd\u5b58\u4e86 drawable \u6587\u4ef6\u5939\u4e2d\u7684\u56fe\u50cf\u526f\u672c\u548c xml \u6587\u4ef6\u5939\u4e2d\u7684 Android XML \u6587\u4ef6\u526f\u672c\uff0c\u8fd9\u4e24\u4e2a\u6587\u4ef6\u5939\u90fd\u4f4d\u4e8e resources \u6587\u4ef6\u5939\u4e2d\uff1a<\/p>\n

\"\"<\/p>\n

\u4e3a\u4e86\u4f7f\u7528 TotalCross \u6a21\u62df\u5668\u8fd0\u884c XML \u6587\u4ef6\uff0c\u6211\u4eec\u6dfb\u52a0\u4e86\u4e00\u4e2a\u540d\u4e3a KnowCode \u7684\u65b0 TotalCross API \u548c\u4e00\u4e2a\u4e3b\u7a97\u53e3\u6765\u52a0\u8f7d XML\u3002\u4e0b\u9762\u7684\u4ee3\u7801\u4f7f\u7528 API \u52a0\u8f7d\u548c\u5448\u73b0 XML\uff1a<\/p>\n

\r\npublic void initUI() {\r\n    XmlScreenAbstractLayout xmlCont = XmlScreenFactory.create(\"xml \/ homeApplianceXML.xml\");\r\n    swap(xmlCont);\r\n}\r\n<\/pre>\n

\u5c31\u8fd9\u6837\uff01\u53ea\u9700\u4e24\u4e2a\u547d\u4ee4\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u4f7f\u7528 TotalCross \u8fd0\u884c Android XML \u6587\u4ef6\u3002\u4ee5\u4e0b\u662f XML \u5982\u4f55\u5728 TotalCross \u7684\u6a21\u62df\u5668\u4e0a\u6267\u884c\uff1a
\n\"\"<\/p>\n

\u5b8c\u6210\u8fd9\u4e2a PoC \u8fd8\u6709\u4e24\u4ef6\u4e8b\u8981\u505a\uff1a\u6dfb\u52a0\u4e00\u4e9b\u4e8b\u4ef6\u6765\u63d0\u4f9b\u7528\u6237\u4ea4\u4e92\uff0c\u5e76\u5728\u6811\u8393\u6d3e\u4e0a\u8fd0\u884c\u5b83\u3002<\/p>\n

\u6dfb\u52a0\u4e8b\u4ef6<\/strong><\/div>\n

KnowCode API \u63d0\u4f9b\u4e86\u4e00\u79cd\u901a\u8fc7 ID\uff08getControlByID\uff09 \u83b7\u53d6 XML \u5143\u7d20\u5e76\u66f4\u6539\u5176\u884c\u4e3a\u7684\u65b9\u6cd5\uff0c\u5982\u6dfb\u52a0\u4e8b\u4ef6\u3001\u66f4\u6539\u53ef\u89c1\u6027\u7b49\u3002<\/p>\n

\u4f8b\u5982\uff0c\u4e3a\u4e86\u4f7f\u7528\u6237\u80fd\u591f\u6539\u53d8\u5bb6\u4e2d\u6216\u5176\u4ed6\u5efa\u7b51\u7269\u7684\u6e29\u5ea6\uff0c\u6211\u4eec\u5728 UI \u5e95\u90e8\u653e\u7f6e\u4e86\u52a0\u53f7\u548c\u51cf\u53f7\u6309\u94ae\uff0c\u5e76\u5728\u6bcf\u6b21\u5355\u51fb\u6309\u94ae\u65f6\u90fd\u4f1a\u51fa\u73b0\u201c\u5355\u51fb\u201d\u4e8b\u4ef6\uff0c\u4f7f\u6e29\u5ea6\u5347\u9ad8\u6216\u964d\u4f4e\u4e00\u5ea6\uff1a<\/p>\n

\r\nButton plus = (Button) xmlCont.getControlByID(\"@+id\/plus\");\r\nLabel insideTempLabel = (Label) xmlCont.getControlByID(\"@+id\/insideTempLabel\");\r\nplus.addPressListener(new PressListener() {\r\n    @Override\r\n    public void controlPressed(ControlEvent e) {\r\n        try {\r\n            String tempString = insideTempLabel.getText();\r\n            int temp;\r\n            temp = Convert.toInt(tempString);\r\n            insideTempLabel.setText(Convert.toString(++temp));\r\n        } catch (InvalidNumberException e1) {\r\n            e1.printStackTrace();\r\n        }\r\n    }\r\n});\r\n<\/pre>\n
\u5728\u6811\u8393\u6d3e 4 \u4e0a\u6d4b\u8bd5<\/strong><\/div>\n

\u6700\u540e\u4e00\u6b65\uff01\u6211\u4eec\u5728\u4e00\u53f0\u8bbe\u5907\u4e0a\u8fd0\u884c\u4e86\u5e94\u7528\u7a0b\u5e8f\u5e76\u68c0\u67e5\u4e86\u7ed3\u679c\u3002\u6211\u4eec\u53ea\u9700\u8981\u6253\u5305\u5e94\u7528\u7a0b\u5e8f\u5e76\u5728\u76ee\u6807\u8bbe\u5907\u4e0a\u90e8\u7f72\u548c\u8fd0\u884c\u5b83\u3002VNC \u4e5f\u53ef\u7528\u4e8e\u68c0\u67e5\u8bbe\u5907\u4e0a\u7684\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n

\u6574\u4e2a\u5e94\u7528\u7a0b\u5e8f\uff0c\u5305\u62ec\u8d44\u6e90\uff08\u56fe\u50cf\u7b49\uff09\u3001Android XML\u3001TotalCross \u548c Knowcode API\uff0c\u5728 Linux ARM \u4e0a\u5927\u7ea6\u662f 8MB\u3002<\/p>\n

\u4e0b\u9762\u662f\u5e94\u7528\u7a0b\u5e8f\u7684\u6f14\u793a\uff1a
\n\"\"<\/p>\n

\u5728\u672c\u4f8b\u4e2d\uff0c\u8be5\u5e94\u7528\u7a0b\u5e8f\u4ec5\u4e3a Linux ARM \u6253\u5305\uff0c\u4f46\u540c\u4e00\u5e94\u7528\u7a0b\u5e8f\u53ef\u4ee5\u4f5c\u4e3a Linux \u684c\u9762\u5e94\u7528\u7a0b\u5e8f\u8fd0\u884c\uff0c\u5728Android \u8bbe\u5907 \u3001Windows\u3001windows CE \u751a\u81f3 iOS \u4e0a\u8fd0\u884c\u3002<\/p>\n

\u6240\u6709\u793a\u4f8b\u6e90\u4ee3\u7801\u548c\u9879\u76ee\u90fd\u53ef\u4ee5\u5728 HomeApplianceXML GitHub \u5b58\u50a8\u5e93\u4e2d\u627e\u5230\u3002<\/p>\n

\u73b0\u6709\u5de5\u5177\u7684\u65b0\u73a9\u6cd5<\/strong><\/div>\n

\u4e3a\u5d4c\u5165\u5f0f\u5e94\u7528\u7a0b\u5e8f\u521b\u5efa GUI \u5e76\u4e0d\u9700\u8981\u50cf\u73b0\u5728\u8fd9\u6837\u56f0\u96be\u3002\u8fd9\u79cd\u6982\u5ff5\u8bc1\u660e\u4e3a\u5982\u4f55\u8f7b\u677e\u5730\u5b8c\u6210\u8fd9\u9879\u4efb\u52a1\u63d0\u4f9b\u4e86\u65b0\u7684\u89c6\u89d2\uff0c\u4e0d\u4ec5\u9002\u7528\u4e8e\u5d4c\u5165\u5f0f\u7cfb\u7edf\uff0c\u800c\u4e14\u9002\u7528\u4e8e\u6240\u6709\u4e3b\u8981\u7684\u64cd\u4f5c\u7cfb\u7edf\uff0c\u6240\u6709\u8fd9\u4e9b\u7cfb\u7edf\u90fd\u4f7f\u7528\u76f8\u540c\u7684\u4ee3\u7801\u5e93\u3002<\/p>\n

\u6211\u4eec\u7684\u76ee\u6807\u4e0d\u662f\u4e3a\u8bbe\u8ba1\u4eba\u5458\u6216\u5f00\u53d1\u4eba\u5458\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u5de5\u5177\u6765\u6784\u5efa UI \u5e94\u7528\u7a0b\u5e8f\uff1b\u6211\u4eec\u7684\u76ee\u6807\u662f\u4e3a\u4f7f\u7528\u73b0\u6709\u7684\u6700\u4f73\u5de5\u5177\u63d0\u4f9b\u65b0\u7684\u73a9\u6cd5\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u4e3a\u5e94\u7528\u7a0b\u5e8f\u521b\u5efa\u826f\u597d\u7684\u7528\u6237\u4f53\u9a8c\uff08UX\uff09\u662f\u4e00\u9879\u8270\u5de8\u7684\u4efb\u52a1\uff0c\u5c24\u5176\u662f\u5728\u5f00\u53d1\u5d4c\u5165\u5f0f\u5e94\u7528\u7a0b\u5e8f\u65f6\u3002\u4eca\u5929\uff0c\u6709\u4e24\u79cd\u56fe\u5f62\u7528\u6237\u754c\u9762\uff08 […]<\/p>\n","protected":false},"author":370,"featured_media":211018,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-212006","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/212006","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/370"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=212006"}],"version-history":[{"count":5,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/212006\/revisions"}],"predecessor-version":[{"id":212240,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/212006\/revisions\/212240"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/211018"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=212006"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=212006"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=212006"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}