{"id":73993,"date":"2026-02-08T22:10:00","date_gmt":"2026-02-08T14:10:00","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/73993.html"},"modified":"2026-02-08T22:10:00","modified_gmt":"2026-02-08T14:10:00","slug":"%e7%a0%b4%e5%a3%81%e8%a1%8c%e5%8a%a8%ef%bc%9a%e5%9c%a8%e6%97%a7%e9%a1%b9%e7%9b%ae%e4%b8%ad%e4%b8%9d%e6%bb%91%e5%b5%8c%e5%85%a5-compose%ef%bc%88%e6%b7%b7%e5%90%88%e5%bc%80%e5%8f%91%e5%ae%9e%e6%88%98","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/73993.html","title":{"rendered":"\u7834\u58c1\u884c\u52a8\uff1a\u5728\u65e7\u9879\u76ee\u4e2d\u4e1d\u6ed1\u5d4c\u5165 Compose\uff08\u6df7\u5408\u5f00\u53d1\u5b9e\u6218\uff09"},"content":{"rendered":"<p>\u5f88\u591a\u5f00\u53d1\u8005\u8ddf\u6211\u62b1\u6028&#xff1a;\u201cCompose \u786e\u5b9e\u597d&#xff0c;\u4f46\u6211\u516c\u53f8\u90a3\u4e2a\u9879\u76ee\u662f\u4e94\u5e74\u524d\u7684\u4ee3\u7801&#xff0c;\u51e0\u767e\u4e2a Activity&#xff0c;\u51e0\u5343\u4e2a XML \u5e03\u5c40&#xff0c;\u8001\u677f\u4e0d\u53ef\u80fd\u8ba9\u6211\u505c\u5de5\u534a\u5e74\u53bb\u5168\u91cf\u91cd\u6784\u3002\u201d<\/p>\n<p>\u8fd9\u592a\u6b63\u5e38\u4e86\u3002\u5728\u6280\u672f\u5708&#xff0c;**\u201c\u5728\u98de\u884c\u7684\u98de\u673a\u4e0a\u6362\u5f15\u64ce\u201d**\u624d\u662f\u5e38\u6001\u3002\u5168\u91cf\u91cd\u6784\u662f\u7406\u60f3\u4e3b\u4e49&#xff0c;**\u6df7\u5408\u5f00\u53d1&#xff08;Interoperability&#xff09;**\u624d\u662f\u771f\u6b63\u7684\u73b0\u5b9e\u4e3b\u4e49\u3002\u4eca\u5929\u8fd9\u7bc7&#xff0c;\u6211\u4eec\u8981\u804a\u804a\u5982\u4f55\u201c\u62c6\u6389 XML \u7684\u56f4\u5899\u201d&#xff0c;\u8ba9 Compose \u50cf\u4e50\u9ad8\u79ef\u6728\u4e00\u6837&#xff0c;\u4e1d\u6ed1\u5730\u585e\u8fdb\u4f60\u7684\u8001\u9879\u76ee\u91cc\u3002<\/p>\n<hr \/>\n<h2>\u7834\u58c1\u884c\u52a8&#xff1a;\u5728\u65e7\u9879\u76ee\u4e2d\u4e1d\u6ed1\u5d4c\u5165 Compose&#xff08;\u6df7\u5408\u5f00\u53d1\u5b9e\u6218&#xff09;<\/h2>\n<h4>\u5bfc\u8bed&#xff1a;\u522b\u505a\u201c\u63a8\u5012\u91cd\u5efa\u201d\u7684\u5e7b\u60f3\u5bb6<\/h4>\n<p>\u5f88\u591a Android \u56e2\u961f\u5728\u9762\u5bf9\u65b0\u67b6\u6784\u65f6&#xff0c;\u6700\u5bb9\u6613\u72af\u7684\u9519\u8bef\u5c31\u662f\u201c\u5927\u5e72\u5feb\u4e0a\u201d\u3002\u7ed3\u679c\u5f80\u5f80\u662f\u65e7 Bug \u8fd8\u6ca1\u89e3\u5b8c&#xff0c;\u65b0\u67b6\u6784\u53c8\u5f15\u5165\u4e86\u4e00\u5806\u9002\u914d\u95ee\u9898\u3002<\/p>\n<p>\u771f\u6b63\u7684\u201c\u7834\u58c1\u201d\u5e94\u8be5\u662f\u4ece\u5c40\u90e8\u5230\u6574\u4f53\u3002Compose \u8bde\u751f\u7684\u521d\u8877&#xff0c;\u5c31\u4e0d\u662f\u4e3a\u4e86\u53d6\u4ee3 View&#xff0c;\u800c\u662f\u4e3a\u4e86\u4e0e View \u5171\u751f\u3002\u65e0\u8bba\u662f\u4f60\u5728 XML \u91cc\u5199 Compose&#xff0c;\u8fd8\u662f\u5728 Compose \u91cc\u8c03\u65e7\u7684 View&#xff0c;Google \u90fd\u7ed9\u4f60\u7559\u597d\u4e86\u201c\u540e\u95e8\u201d\u3002<\/p>\n<hr \/>\n<h3>\u4e00\u3001 \u5411\u5185\u7a81\u56f4&#xff1a;\u5728 XML \u9886\u5730\u63d2\u4e0a Compose \u7684\u65d7\u5e1c<\/h3>\n<p>\u8fd9\u662f\u6700\u5e38\u89c1\u7684\u573a\u666f&#xff1a;\u8001\u9875\u9762\u7684\u4e1a\u52a1\u903b\u8f91\u5f88\u91cd&#xff0c;\u4f60\u4e0d\u6562\u4e71\u52a8&#xff0c;\u4f46\u4f60\u9700\u8981\u5f80\u91cc\u9762\u52a0\u4e00\u4e2a\u590d\u6742\u7684 UI \u7ec4\u4ef6&#xff08;\u6bd4\u5982\u4e00\u4e2a\u52a8\u6001\u8fdb\u5ea6\u6761&#xff09;\u3002<\/p>\n<h4>1. \u5bbf\u4e3b&#xff1a;ComposeView<\/h4>\n<p>\u5728 XML \u5e03\u5c40\u4e2d&#xff0c;\u4f60\u53ea\u9700\u8981\u653e\u4e00\u4e2a\u5360\u4f4d\u7b26&#xff1a;<\/p>\n<p><span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;<\/span>LinearLayout<\/span> <span class=\"token attr-name\">&#8230;<\/span><span class=\"token punctuation\">&gt;<\/span><\/span><br \/>\n    <span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;<\/span>TextView<\/span> <span class=\"token attr-name\"><span class=\"token namespace\">android:<\/span>text<\/span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">&#061;<\/span><span class=\"token punctuation\">&#034;<\/span>\u6211\u662f\u65e7\u7684 View<span class=\"token punctuation\">&#034;<\/span><\/span> <span class=\"token attr-name\">&#8230;<\/span> <span class=\"token punctuation\">\/&gt;<\/span><\/span><\/p>\n<p>    <span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;<\/span>androidx.compose.ui.platform.ComposeView<\/span><br \/>\n        <span class=\"token attr-name\"><span class=\"token namespace\">android:<\/span>id<\/span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">&#061;<\/span><span class=\"token punctuation\">&#034;<\/span>&#064;&#043;id\/compose_view<span class=\"token punctuation\">&#034;<\/span><\/span><br \/>\n        <span class=\"token attr-name\"><span class=\"token namespace\">android:<\/span>layout_width<\/span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">&#061;<\/span><span class=\"token punctuation\">&#034;<\/span>match_parent<span class=\"token punctuation\">&#034;<\/span><\/span><br \/>\n        <span class=\"token attr-name\"><span class=\"token namespace\">android:<\/span>layout_height<\/span><span class=\"token attr-value\"><span class=\"token punctuation attr-equals\">&#061;<\/span><span class=\"token punctuation\">&#034;<\/span>wrap_content<span class=\"token punctuation\">&#034;<\/span><\/span> <span class=\"token punctuation\">\/&gt;<\/span><\/span><br \/>\n<span class=\"token tag\"><span class=\"token tag\"><span class=\"token punctuation\">&lt;\/<\/span>LinearLayout<\/span><span class=\"token punctuation\">&gt;<\/span><\/span><\/p>\n<h4>2. \u6ce8\u5165\u903b\u8f91<\/h4>\n<p>\u5728 Activity \u91cc&#xff0c;\u4f60\u50cf\u64cd\u4f5c\u666e\u901a View \u4e00\u6837\u627e\u5230\u5b83&#xff0c;\u7136\u540e\u5f00\u542f Compose \u4e16\u754c&#xff1a;<\/p>\n<p><span class=\"token keyword\">class<\/span> OldActivity <span class=\"token operator\">:<\/span> <span class=\"token function\">AppCompatActivity<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">override<\/span> <span class=\"token keyword\">fun<\/span> <span class=\"token function\">onCreate<\/span><span class=\"token punctuation\">(<\/span>savedInstanceState<span class=\"token operator\">:<\/span> Bundle<span class=\"token operator\">?<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token keyword\">super<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">onCreate<\/span><span class=\"token punctuation\">(<\/span>savedInstanceState<span class=\"token punctuation\">)<\/span><br \/>\n        <span class=\"token function\">setContentView<\/span><span class=\"token punctuation\">(<\/span>R<span class=\"token punctuation\">.<\/span>layout<span class=\"token punctuation\">.<\/span>layout_old_activity<span class=\"token punctuation\">)<\/span><\/p>\n<p>        findViewById<span class=\"token operator\">&lt;<\/span>ComposeView<span class=\"token operator\">&gt;<\/span><span class=\"token punctuation\">(<\/span>R<span class=\"token punctuation\">.<\/span>id<span class=\"token punctuation\">.<\/span>compose_view<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">apply<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n            <span class=\"token comment\">\/\/ \u8bbe\u7f6e\u7b56\u7565&#xff1a;\u5f53 View \u88ab\u4ece\u7a97\u4f53\u79fb\u9664\u65f6\u5904\u7f6e\u7ec4\u5408<\/span><br \/>\n            <span class=\"token function\">setViewCompositionStrategy<\/span><span class=\"token punctuation\">(<\/span>ViewCompositionStrategy<span class=\"token punctuation\">.<\/span>DisposeOnViewTreeLifecycleDestroyed<span class=\"token punctuation\">)<\/span><\/p>\n<p>            setContent <span class=\"token punctuation\">{<\/span><br \/>\n                MaterialTheme <span class=\"token punctuation\">{<\/span><br \/>\n                    <span class=\"token comment\">\/\/ \u8fd9\u91cc\u5199\u4f60\u7684 Compose \u4ee3\u7801<\/span><br \/>\n                    <span class=\"token function\">NewFeatureScreen<\/span><span class=\"token punctuation\">(<\/span>title <span class=\"token operator\">&#061;<\/span> <span class=\"token string-literal singleline\"><span class=\"token string\">&#034;\u6211\u662f\u88ab\u5d4c\u5165\u7684 Compose&#034;<\/span><\/span><span class=\"token punctuation\">)<\/span><br \/>\n                <span class=\"token punctuation\">}<\/span><br \/>\n            <span class=\"token punctuation\">}<\/span><br \/>\n        <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u907f\u5751\u6307\u5357&#xff1a; \u52a1\u5fc5\u8bbe\u7f6e setViewCompositionStrategy&#xff0c;\u5426\u5219\u53ef\u80fd\u4f1a\u56e0\u4e3a Compose \u6ca1\u80fd\u53ca\u65f6\u611f\u77e5 Activity \u751f\u547d\u5468\u671f\u800c\u5bfc\u81f4\u5185\u5b58\u6cc4\u6f0f\u6216\u5954\u6e83\u3002<\/p>\n<hr \/>\n<h3>\u4e8c\u3001 \u5411\u5916\u501f\u529b&#xff1a;\u5728 Compose \u91cc\u201c\u53ec\u5524\u201d\u65e7\u795e<\/h3>\n<p>\u6709\u65f6\u5019\u4f60\u5df2\u7ecf\u5168\u9762\u5207\u6362\u5230 Compose \u4e86&#xff0c;\u4f46\u6709\u4e9b\u8001\u53e4\u8463\u4f60\u7ed5\u4e0d\u5f00&#xff1a;\u6bd4\u5982\u9ad8\u5fb7\u5730\u56fe\u3001\u817e\u8baf\u89c6\u9891\u64ad\u653e\u5668&#xff0c;\u6216\u8005\u4f60\u516c\u53f8\u6c89\u6dc0\u4e86\u4e94\u5e74\u7684\u90a3\u4e2a\u8d85\u7ea7\u590d\u6742\u7684\u201c\u81ea\u5b9a\u4e49\u6298\u7ebf\u56fe\u201d\u3002<\/p>\n<h4>\u5b9e\u6218&#xff1a;AndroidView \u5c01\u88c5<\/h4>\n<p>\u6211\u4eec\u4ee5\u96c6\u6210\u4e00\u4e2a\u7ecf\u5178\u7684 WebView \u4e3a\u4f8b&#xff1a;<\/p>\n<p><span class=\"token annotation builtin\">&#064;Composable<\/span><br \/>\n<span class=\"token keyword\">fun<\/span> <span class=\"token function\">LegacyWebView<\/span><span class=\"token punctuation\">(<\/span>url<span class=\"token operator\">:<\/span> String<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token comment\">\/\/ AndroidView \u662f\u8fde\u63a5\u4e24\u4e2a\u4e16\u754c\u7684\u866b\u6d1e<\/span><br \/>\n    <span class=\"token function\">AndroidView<\/span><span class=\"token punctuation\">(<\/span><br \/>\n        factory <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">{<\/span> context <span class=\"token operator\">-&gt;<\/span><br \/>\n            <span class=\"token comment\">\/\/ \u8fd9\u91cc\u521b\u5efa\u4f20\u7edf\u7684 View \u5bf9\u8c61<\/span><br \/>\n            <span class=\"token function\">WebView<\/span><span class=\"token punctuation\">(<\/span>context<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">apply<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n                settings<span class=\"token punctuation\">.<\/span>javaScriptEnabled <span class=\"token operator\">&#061;<\/span> <span class=\"token boolean\">true<\/span><br \/>\n                webViewClient <span class=\"token operator\">&#061;<\/span> <span class=\"token function\">WebViewClient<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n            <span class=\"token punctuation\">}<\/span><br \/>\n        <span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">,<\/span><br \/>\n        modifier <span class=\"token operator\">&#061;<\/span> Modifier<span class=\"token punctuation\">.<\/span><span class=\"token function\">fillMaxSize<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span><br \/>\n        update <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">{<\/span> webView <span class=\"token operator\">-&gt;<\/span><br \/>\n            <span class=\"token comment\">\/\/ \u5f53 Compose \u72b6\u6001\u6539\u53d8\u65f6&#xff0c;\u8fd9\u91cc\u4f1a\u88ab\u8c03\u7528&#xff0c;\u7528\u4e8e\u66f4\u65b0\u65e7 View<\/span><br \/>\n            webView<span class=\"token punctuation\">.<\/span><span class=\"token function\">loadUrl<\/span><span class=\"token punctuation\">(<\/span>url<span class=\"token punctuation\">)<\/span><br \/>\n        <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u539f\u7406&#xff1a; factory \u53ea\u8dd1\u4e00\u6b21&#xff08;\u521d\u59cb\u5316&#xff09;&#xff0c;\u800c update \u4f1a\u968f\u7740 Compose \u7684\u91cd\u7ec4\u53cd\u590d\u6267\u884c\u3002\u8fd9\u8ba9\u65e7\u7684 View \u4e5f\u80fd\u5177\u5907\u201c\u54cd\u5e94\u5f0f\u201d\u7684\u7279\u6027\u3002<\/p>\n<hr \/>\n<h3>\u4e09\u3001 \u7075\u9b42\u7edf\u4e00&#xff1a;\u6837\u5f0f\u4e0e\u4e3b\u9898\u7684\u8fc1\u5f99<\/h3>\n<p>\u6df7\u5408\u5f00\u53d1\u6700\u6015\u7684\u5c31\u662f\u201c\u5404\u957f\u5404\u7684\u201d\u3002XML \u91cc\u662f\u84dd\u8272\u7684\u4e3b\u9898&#xff0c;Compose \u91cc\u8dd1\u51fa\u6765\u4e00\u4e2a\u7d2b\u8272\u4e3b\u9898&#xff0c;\u8fd9\u79cd\u6495\u88c2\u611f\u4f1a\u8ba9\u7528\u6237\u89c9\u5f97\u4f60\u5728\u505a\u4e24\u4e2a App\u3002<\/p>\n<h4>\u63a8\u8350\u65b9\u6848&#xff1a;Accompanist Theme Adapter<\/h4>\n<p>Google \u63d0\u4f9b\u4e86\u4e00\u5957\u9002\u914d\u5668&#xff0c;\u53ef\u4ee5\u76f4\u63a5\u628a\u4f60\u7684 styles.xml \u8f6c\u5316\u4e3a Compose \u7684 ColorScheme\u3002<\/p>\n<p><span class=\"token comment\">\/\/ \u5728 Compose \u6839\u90e8\u4f7f\u7528<\/span><br \/>\nMdcTheme <span class=\"token punctuation\">{<\/span> <span class=\"token comment\">\/\/ \u81ea\u52a8\u8bfb\u53d6\u4f60\u7684 Material Design Components XML \u4e3b\u9898<\/span><br \/>\n    <span class=\"token function\">AppScreen<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u8fd9\u6837\u4f60\u5c31\u4e0d\u9700\u8981\u7ef4\u62a4\u4e24\u5957\u8272\u503c\u548c\u5b57\u4f53\u914d\u7f6e\u4e86&#xff0c;\u771f\u6b63\u5b9e\u73b0\u201c\u89c6\u89c9\u5927\u7edf\u4e00\u201d\u3002<\/p>\n<hr \/>\n<h3>\u56db\u3001 \u7b56\u7565\u601d\u8003&#xff1a;\u4ec0\u4e48\u65f6\u5019\u8be5\u201c\u7834\u58c1\u201d&#xff1f;<\/h3>\n<p>\u4f5c\u4e3a\u4e00\u540d\u8d44\u6df1\u7684\u884c\u4e1a\u89c2\u5bdf\u8005&#xff0c;\u6211\u5efa\u8bae\u4f60\u7684\u6df7\u5408\u5f00\u53d1\u8def\u7ebf\u56fe\u5982\u4e0b&#xff1a;<\/p>\n<li>Level 1&#xff1a;\u65b0\u9875\u9762\u5168\u91cf Compose\u3002 \u5373\u4f7f\u9879\u76ee\u518d\u8001&#xff0c;\u65b0\u5f00\u7684 Activity\/Fragment \u5fc5\u987b\u7528 Compose\u3002<\/li>\n<li>Level 2&#xff1a;\u65e7\u9875\u9762\u7684\u65b0\u7ec4\u4ef6\u3002 \u7528 ComposeView \u66ff\u6362\u6389\u90a3\u4e9b\u590d\u6742\u7684\u81ea\u5b9a\u4e49 View\u3002<\/li>\n<li>Level 3&#xff1a;\u65e7\u9875\u9762\u7684\u5f7b\u5e95\u66ff\u6362\u3002 \u53ea\u6709\u5f53\u8001\u9875\u9762\u9700\u8981\u8fdb\u884c\u91cd\u5927\u903b\u8f91\u91cd\u6784\u65f6&#xff0c;\u624d\u8003\u8651\u5f7b\u5e95\u5e72\u6389 XML\u3002<\/li>\n<hr \/>\n<h3>\u7ed3\u8bed&#xff1a;\u56f4\u5899\u5012\u584c\u4e4b\u540e<\/h3>\n<p>\u6df7\u5408\u5f00\u53d1\u4e0d\u662f\u76ee\u7684&#xff0c;\u5b83\u662f\u901a\u5f80\u9ad8\u6548\u5f00\u53d1\u7684\u6865\u6881\u3002\u5f53\u4f60\u5b66\u4f1a\u4e86\u5728 XML \u548c Compose \u4e4b\u95f4\u53cd\u590d\u6a2a\u8df3\u4e14\u4e0d\u5931\u4f18\u96c5\u65f6&#xff0c;\u4f60\u5c31\u5df2\u7ecf\u4e0d\u518d\u662f\u88ab\u5de5\u5177\u675f\u7f1a\u7684\u201c\u7801\u519c\u201d&#xff0c;\u800c\u662f\u80fd\u638c\u63a7\u5168\u5c40\u7684\u201c\u67b6\u6784\u5e08\u201d\u3002<\/p>\n<p>\u4f46\u5f53\u4f60\u5b66\u4f1a\u4e86\u7ed8\u56fe\u3001\u5b66\u4f1a\u4e86\u5bfc\u822a\u3001\u5b66\u4f1a\u4e86\u6df7\u5408\u5f00\u53d1&#xff0c;\u4f60\u662f\u5426\u60f3\u8fc7&#xff1a;\u5982\u679c\u6211\u60f3\u5b9e\u73b0\u90a3\u79cd\u7a81\u7834\u6b21\u5143\u58c1\u7684\u89c6\u89c9\u4ea4\u4e92&#xff0c;\u6bd4\u5982\u4e00\u4e2a\u4f1a\u968f\u624b\u6307\u821e\u52a8\u7684\u7c92\u5b50\u6548\u679c&#xff0c;\u6216\u8005\u4e00\u4e2a\u6df1\u4e0d\u89c1\u5e95\u7684 3D \u66f2\u7ebf&#xff0c;\u8be5\u600e\u4e48\u529e&#xff1f;<\/p>\n<p>\u4e92\u52a8\u65f6\u95f4&#xff1a;<br \/>\n\u4f60\u7684\u9879\u76ee\u4e2d&#xff0c;\u54ea\u7c7b\u8001\u7ec4\u4ef6\u6700\u8ba9\u4f60\u5934\u75bc&#xff1f;\u662f\u90a3\u4e2a\u51e0\u5343\u884c\u7684 ListView \u9002\u914d\u5668&#xff0c;\u8fd8\u662f\u90a3\u4e2a\u65e0\u6cd5\u8fc1\u79fb\u7684\u7b2c\u4e09\u65b9\u5730\u56fe SDK&#xff1f;\u6b22\u8fce\u5728\u8bc4\u8bba\u533a\u7559\u8a00&#xff0c;\u6211\u4eec\u4e00\u8d77\u8ba8\u8bba\u201c\u7834\u58c1\u201d\u65b9\u6848\u3002<\/p>\n<hr \/>\n<p>\u4e0b\u4e00\u7bc7\u9884\u544a&#xff1a; \u300a\u89c6\u89c9\u7bc7&#xff1a;Canvas \u81ea\u5b9a\u4e49\u7ed8\u56fe\u4e0e\u9ad8\u7ea7\u52a8\u753b\u7684\u534e\u4e3d\u5706\u821e\u66f2\u300b<\/p>\n<hr \/>\n<p>\u8fd9\u662f\u7b2c\u4e03\u7bc7\u7684\u5185\u5bb9\u3002<br \/>\n\u91cd\u70b9\u8bb2\u89e3\u4e86 ComposeView \u548c AndroidView \u8fd9\u4e24\u4e2a\u6df7\u5408\u5f00\u53d1\u7684\u6838\u5fc3&#xff0c;\u5b9e\u64cd\u6027\u6781\u5f3a\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5f88\u591a\u5f00\u53d1\u8005\u8ddf\u6211\u62b1\u6028&#xff1a;\u201cCompose \u786e\u5b9e\u597d&#xff0c;\u4f46\u6211\u516c\u53f8\u90a3\u4e2a\u9879\u76ee\u662f\u4e94\u5e74\u524d\u7684\u4ee3\u7801&#xff0c;\u51e0\u767e\u4e2a Activity&#xff0c;\u51e0\u5343\u4e2a XML \u5e03\u5c40&#xff0c;\u8001\u677f\u4e0d\u53ef\u80fd\u8ba9\u6211\u505c\u5de5\u534a\u5e74\u53bb\u5168\u91cf\u91cd\u6784\u3002\u201d<br \/>\n\u8fd9\u592a\u6b63\u5e38\u4e86\u3002\u5728\u6280\u672f\u5708&#xff0c;**\u201c\u5728\u98de\u884c\u7684\u98de\u673a\u4e0a\u6362\u5f15\u64ce\u201d**\u624d\u662f\u5e38\u6001\u3002\u5168\u91cf\u91cd\u6784\u662f\u7406\u60f3\u4e3b\u4e49&#xff0c;**\u6df7\u5408\u5f00\u53d1&#xff08;Interoperability&#xff09;**\u624d\u662f\u771f\u6b63\u7684\u73b0\u5b9e\u4e3b\u4e49\u3002\u4eca\u5929\u8fd9\u7bc7&#xff0c;\u6211\u4eec\u8981\u804a\u804a<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[84,5754,124],"topic":[],"class_list":["post-73993","post","type-post","status-publish","format-standard","hentry","category-server","tag-android","tag-android-jetpack","tag-124"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u7834\u58c1\u884c\u52a8\uff1a\u5728\u65e7\u9879\u76ee\u4e2d\u4e1d\u6ed1\u5d4c\u5165 Compose\uff08\u6df7\u5408\u5f00\u53d1\u5b9e\u6218\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/73993.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u7834\u58c1\u884c\u52a8\uff1a\u5728\u65e7\u9879\u76ee\u4e2d\u4e1d\u6ed1\u5d4c\u5165 Compose\uff08\u6df7\u5408\u5f00\u53d1\u5b9e\u6218\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u5f88\u591a\u5f00\u53d1\u8005\u8ddf\u6211\u62b1\u6028&#xff1a;\u201cCompose \u786e\u5b9e\u597d&#xff0c;\u4f46\u6211\u516c\u53f8\u90a3\u4e2a\u9879\u76ee\u662f\u4e94\u5e74\u524d\u7684\u4ee3\u7801&#xff0c;\u51e0\u767e\u4e2a Activity&#xff0c;\u51e0\u5343\u4e2a XML \u5e03\u5c40&#xff0c;\u8001\u677f\u4e0d\u53ef\u80fd\u8ba9\u6211\u505c\u5de5\u534a\u5e74\u53bb\u5168\u91cf\u91cd\u6784\u3002\u201d \u8fd9\u592a\u6b63\u5e38\u4e86\u3002\u5728\u6280\u672f\u5708&#xff0c;**\u201c\u5728\u98de\u884c\u7684\u98de\u673a\u4e0a\u6362\u5f15\u64ce\u201d**\u624d\u662f\u5e38\u6001\u3002\u5168\u91cf\u91cd\u6784\u662f\u7406\u60f3\u4e3b\u4e49&#xff0c;**\u6df7\u5408\u5f00\u53d1&#xff08;Interoperability&#xff09;**\u624d\u662f\u771f\u6b63\u7684\u73b0\u5b9e\u4e3b\u4e49\u3002\u4eca\u5929\u8fd9\u7bc7&#xff0c;\u6211\u4eec\u8981\u804a\u804a\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/73993.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-02-08T14:10:00+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/73993.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/73993.html\",\"name\":\"\u7834\u58c1\u884c\u52a8\uff1a\u5728\u65e7\u9879\u76ee\u4e2d\u4e1d\u6ed1\u5d4c\u5165 Compose\uff08\u6df7\u5408\u5f00\u53d1\u5b9e\u6218\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-02-08T14:10:00+00:00\",\"dateModified\":\"2026-02-08T14:10:00+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/73993.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/73993.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/73993.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u7834\u58c1\u884c\u52a8\uff1a\u5728\u65e7\u9879\u76ee\u4e2d\u4e1d\u6ed1\u5d4c\u5165 Compose\uff08\u6df7\u5408\u5f00\u53d1\u5b9e\u6218\uff09\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u7834\u58c1\u884c\u52a8\uff1a\u5728\u65e7\u9879\u76ee\u4e2d\u4e1d\u6ed1\u5d4c\u5165 Compose\uff08\u6df7\u5408\u5f00\u53d1\u5b9e\u6218\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/73993.html","og_locale":"zh_CN","og_type":"article","og_title":"\u7834\u58c1\u884c\u52a8\uff1a\u5728\u65e7\u9879\u76ee\u4e2d\u4e1d\u6ed1\u5d4c\u5165 Compose\uff08\u6df7\u5408\u5f00\u53d1\u5b9e\u6218\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u5f88\u591a\u5f00\u53d1\u8005\u8ddf\u6211\u62b1\u6028&#xff1a;\u201cCompose \u786e\u5b9e\u597d&#xff0c;\u4f46\u6211\u516c\u53f8\u90a3\u4e2a\u9879\u76ee\u662f\u4e94\u5e74\u524d\u7684\u4ee3\u7801&#xff0c;\u51e0\u767e\u4e2a Activity&#xff0c;\u51e0\u5343\u4e2a XML \u5e03\u5c40&#xff0c;\u8001\u677f\u4e0d\u53ef\u80fd\u8ba9\u6211\u505c\u5de5\u534a\u5e74\u53bb\u5168\u91cf\u91cd\u6784\u3002\u201d \u8fd9\u592a\u6b63\u5e38\u4e86\u3002\u5728\u6280\u672f\u5708&#xff0c;**\u201c\u5728\u98de\u884c\u7684\u98de\u673a\u4e0a\u6362\u5f15\u64ce\u201d**\u624d\u662f\u5e38\u6001\u3002\u5168\u91cf\u91cd\u6784\u662f\u7406\u60f3\u4e3b\u4e49&#xff0c;**\u6df7\u5408\u5f00\u53d1&#xff08;Interoperability&#xff09;**\u624d\u662f\u771f\u6b63\u7684\u73b0\u5b9e\u4e3b\u4e49\u3002\u4eca\u5929\u8fd9\u7bc7&#xff0c;\u6211\u4eec\u8981\u804a\u804a","og_url":"https:\/\/www.wsisp.com\/helps\/73993.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-02-08T14:10:00+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/73993.html","url":"https:\/\/www.wsisp.com\/helps\/73993.html","name":"\u7834\u58c1\u884c\u52a8\uff1a\u5728\u65e7\u9879\u76ee\u4e2d\u4e1d\u6ed1\u5d4c\u5165 Compose\uff08\u6df7\u5408\u5f00\u53d1\u5b9e\u6218\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-02-08T14:10:00+00:00","dateModified":"2026-02-08T14:10:00+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/73993.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/73993.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/73993.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u7834\u58c1\u884c\u52a8\uff1a\u5728\u65e7\u9879\u76ee\u4e2d\u4e1d\u6ed1\u5d4c\u5165 Compose\uff08\u6df7\u5408\u5f00\u53d1\u5b9e\u6218\uff09"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/73993","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=73993"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/73993\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=73993"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=73993"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=73993"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=73993"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}