{"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":"
\u5bfc\u8bfb<\/td>\n | AndroidXML \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 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 |