{"id":477,"date":"2025-04-18T11:30:08","date_gmt":"2025-04-18T03:30:08","guid":{"rendered":"https:\/\/trantor.ink\/?p=477"},"modified":"2025-04-18T11:30:46","modified_gmt":"2025-04-18T03:30:46","slug":"material3-%e4%b8%ad%e7%9a%84bottomsheetdialogfragment-%e5%a6%82%e4%bd%95%e5%ae%9e%e7%8e%b0%e9%a2%84%e6%b5%8b%e6%80%a7%e8%bf%94%e5%9b%9e%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/trantor.ink\/?p=477","title":{"rendered":"material3 \u4e2d\u7684BottomSheetDialogFragment \u5982\u4f55\u5b9e\u73b0\u9884\u6d4b\u6027\u8fd4\u56de\uff1f"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_81 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/trantor.ink\/?p=477\/#%E2%9C%85_1_%E4%BD%BF%E7%94%A8%E6%94%AF%E6%8C%81%E9%A2%84%E6%B5%8B%E6%80%A7%E8%BF%94%E5%9B%9E%E7%9A%84_Android_%E7%89%88%E6%9C%AC\" >\u2705 1.\u00a0\u4f7f\u7528\u652f\u6301\u9884\u6d4b\u6027\u8fd4\u56de\u7684 Android \u7248\u672c<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/trantor.ink\/?p=477\/#%E2%9C%85_2_%E4%BD%BF%E7%94%A8_Material3_%E5%92%8C%E6%9C%80%E6%96%B0%E4%BE%9D%E8%B5%96\" >\u2705 2.\u00a0\u4f7f\u7528 Material3 \u548c\u6700\u65b0\u4f9d\u8d56<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/trantor.ink\/?p=477\/#%E2%9C%85_3_%E4%B8%BA_BottomSheetDialogFragment_%E8%AE%BE%E7%BD%AE%E5%90%88%E9%80%82%E7%9A%84_theme\" >\u2705 3.\u00a0\u4e3a BottomSheetDialogFragment \u8bbe\u7f6e\u5408\u9002\u7684 theme<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/trantor.ink\/?p=477\/#%E2%9C%85_4_%E5%90%AF%E7%94%A8_Activity_%E7%BA%A7%E5%88%AB%E7%9A%84%E9%A2%84%E6%B5%8B%E6%80%A7%E8%BF%94%E5%9B%9E%E6%94%AF%E6%8C%81\" >\u2705 4.\u00a0\u542f\u7528 Activity \u7ea7\u522b\u7684\u9884\u6d4b\u6027\u8fd4\u56de\u652f\u6301<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/trantor.ink\/?p=477\/#AndroidManifestxml_%E4%B8%AD%E8%AE%BE%E7%BD%AE%EF%BC%9A\" >AndroidManifest.xml \u4e2d\u8bbe\u7f6e\uff1a<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/trantor.ink\/?p=477\/#%E2%9C%85_5_%E5%AE%9E%E7%8E%B0%E9%A2%84%E6%B5%8B%E6%80%A7%E8%BF%94%E5%9B%9E%E5%9B%9E%E8%B0%83%EF%BC%88%E5%8F%AF%E9%80%89%EF%BC%89\" >\u2705 5.\u00a0\u5b9e\u73b0\u9884\u6d4b\u6027\u8fd4\u56de\u56de\u8c03\uff08\u53ef\u9009\uff09<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/trantor.ink\/?p=477\/#%E2%9C%85_6_%E9%80%82%E9%85%8D_Navigation_Component%EF%BC%88%E5%A6%82%E6%9C%89%EF%BC%89\" >\u2705 6.\u00a0\u9002\u914d Navigation Component\uff08\u5982\u6709\uff09<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/trantor.ink\/?p=477\/#%F0%9F%93%8C_%E9%A2%84%E6%B5%8B%E6%80%A7%E8%BF%94%E5%9B%9E%E7%9A%84%E6%B5%8B%E8%AF%95%E6%96%B9%E6%B3%95\" >\ud83d\udccc \u9884\u6d4b\u6027\u8fd4\u56de\u7684\u6d4b\u8bd5\u65b9\u6cd5<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/trantor.ink\/?p=477\/#%F0%9F%9A%AB_%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98\" >\ud83d\udeab \u5e38\u89c1\u95ee\u9898<\/a><\/li><\/ul><\/nav><\/div>\n\n<p>\u5728 Material3 \u4e2d\uff0cBottomSheetDialogFragment\uff08\u901a\u5e38\u7ee7\u627f\u81ea com.google.android.material.bottomsheet.BottomSheetDialogFragment\uff09\u9ed8\u8ba4\u662f\u652f\u6301\u9884\u6d4b\u6027\u8fd4\u56de\uff08Predictive Back\uff09\u7684\uff0c\u4f46\u8981\u8ba9\u5b83\u771f\u6b63\u4e0e Android 14\uff08API 34\uff09\u4e0a\u7684\u9884\u6d4b\u6027\u8fd4\u56de\u52a8\u753b\u534f\u4f5c\u826f\u597d\uff0c\u8fd8\u9700\u8981\u786e\u4fdd\u51e0\u4e2a\u5173\u952e\u70b9\u90fd\u6ee1\u8db3\u3002<\/p>\n\n\n\n<p>\u4e0b\u9762\u662f\u5b9e\u73b0\u9884\u6d4b\u6027\u8fd4\u56de\u7684\u5177\u4f53\u6b65\u9aa4\u548c\u6ce8\u610f\u4e8b\u9879\uff1a<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E2%9C%85_1_%E4%BD%BF%E7%94%A8%E6%94%AF%E6%8C%81%E9%A2%84%E6%B5%8B%E6%80%A7%E8%BF%94%E5%9B%9E%E7%9A%84_Android_%E7%89%88%E6%9C%AC\"><\/span><strong>\u2705 1.\u00a0\u4f7f\u7528\u652f\u6301\u9884\u6d4b\u6027\u8fd4\u56de\u7684 Android \u7248\u672c<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u9884\u6d4b\u6027\u8fd4\u56de\u52a8\u753b\u662f\u4ece Android 13\uff08\u90e8\u5206\u652f\u6301\uff09\u548c Android 14\uff08\u5168\u9762\u652f\u6301\uff09\u5f00\u59cb\u5f15\u5165\u7684\uff0c\u6240\u4ee5\u8981\u6d4b\u8bd5\u5b83\u9700\u8981\u8fd0\u884c\u5728 Android 14+ \u7684\u8bbe\u5907\u6216\u6a21\u62df\u5668\u4e0a\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E2%9C%85_2_%E4%BD%BF%E7%94%A8_Material3_%E5%92%8C%E6%9C%80%E6%96%B0%E4%BE%9D%E8%B5%96\"><\/span><strong>\u2705 2.\u00a0\u4f7f\u7528 Material3 \u548c\u6700\u65b0\u4f9d\u8d56<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u786e\u4fdd\u4f60\u7684 material \u7ec4\u4ef6\u5e93\u662f <strong>1.9.0 \u4ee5\u4e0a\u7248\u672c<\/strong>\uff08\u63a8\u8350\u4f7f\u7528\u6700\u65b0\uff09\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">implementation \"com.google.android.material:material:1.11.0\" \/\/ \u6216\u66f4\u9ad8\u7248\u672c<\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E2%9C%85_3_%E4%B8%BA_BottomSheetDialogFragment_%E8%AE%BE%E7%BD%AE%E5%90%88%E9%80%82%E7%9A%84_theme\"><\/span><strong>\u2705 3.\u00a0\u4e3a BottomSheetDialogFragment \u8bbe\u7f6e\u5408\u9002\u7684 theme<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Material3 \u7684 BottomSheet \u9ed8\u8ba4\u5df2\u7ecf\u96c6\u6210\u4e86\u9884\u6d4b\u6027\u8fd4\u56de\u652f\u6301\uff0c\u4f46\u4f60\u8981\u786e\u4fdd\u5b83\u4f7f\u7528\u7684\u662f Material3 \u4e3b\u9898\uff0c\u6bd4\u5982\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;style name=\"AppTheme.BottomSheetDialog\" parent=\"Theme.Material3.DayNight.BottomSheetDialog\">\n    &lt;!-- \u81ea\u5b9a\u4e49\u4f60\u7684\u6837\u5f0f -->\n&lt;\/style><\/pre>\n\n\n\n<p>\u5728 Fragment \u4e2d\u4f7f\u7528\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">override fun getTheme(): Int {\n    return R.style.AppTheme_BottomSheetDialog\n}<\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E2%9C%85_4_%E5%90%AF%E7%94%A8_Activity_%E7%BA%A7%E5%88%AB%E7%9A%84%E9%A2%84%E6%B5%8B%E6%80%A7%E8%BF%94%E5%9B%9E%E6%94%AF%E6%8C%81\"><\/span><strong>\u2705 4.\u00a0\u542f\u7528 Activity \u7ea7\u522b\u7684\u9884\u6d4b\u6027\u8fd4\u56de\u652f\u6301<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u786e\u4fdd\u4f60\u7684 Activity \u5f00\u542f\u4e86\u8fd9\u4e2a\u7279\u6027\uff1a<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"AndroidManifestxml_%E4%B8%AD%E8%AE%BE%E7%BD%AE%EF%BC%9A\"><\/span><strong>AndroidManifest.xml \u4e2d\u8bbe\u7f6e\uff1a<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;application\n    android:enableOnBackInvokedCallback=\"true\"\n    ... ><\/pre>\n\n\n\n<p>\u6216\u8005\u5355\u72ec\u5728 Activity \u4e0a\u8bbe\u7f6e\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;activity\n    android:enableOnBackInvokedCallback=\"true\"\n    ... \/><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E2%9C%85_5_%E5%AE%9E%E7%8E%B0%E9%A2%84%E6%B5%8B%E6%80%A7%E8%BF%94%E5%9B%9E%E5%9B%9E%E8%B0%83%EF%BC%88%E5%8F%AF%E9%80%89%EF%BC%89\"><\/span><strong>\u2705 5.\u00a0\u5b9e\u73b0\u9884\u6d4b\u6027\u8fd4\u56de\u56de\u8c03\uff08\u53ef\u9009\uff09<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u4ece Android 13\uff08API 33\uff09\u8d77\uff0c\u53ef\u4ee5\u901a\u8fc7 OnBackInvokedDispatcher \u6ce8\u518c\u8fd4\u56de\u4e8b\u4ef6\u56de\u8c03\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {\n    requireActivity().onBackInvokedDispatcher.registerOnBackInvokedCallback(\n        OnBackInvokedDispatcher.PRIORITY_DEFAULT\n    ) {\n        \/\/ \u5173\u95ed bottom sheet \u6216\u81ea\u5b9a\u4e49\u8fd4\u56de\u903b\u8f91\n        dismiss()\n    }\n}<\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>\u8fd9\u4e2a\u901a\u5e38\u4e0d\u9700\u8981\u5199\uff0c\u9664\u975e\u4f60\u6709\u81ea\u5b9a\u4e49\u7684\u8fd4\u56de\u5904\u7406\u903b\u8f91\u3002<\/p>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E2%9C%85_6_%E9%80%82%E9%85%8D_Navigation_Component%EF%BC%88%E5%A6%82%E6%9C%89%EF%BC%89\"><\/span><strong>\u2705 6.\u00a0\u9002\u914d Navigation Component\uff08\u5982\u6709\uff09<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u5982\u679c\u4f60\u4f7f\u7528 Jetpack Navigation \u6765\u7ba1\u7406 Fragment \u6808\uff0c\u4e5f\u9700\u8981\u8ba9 Navigation \u652f\u6301 OnBackPressedDispatcher \u6216 OnBackInvokedDispatcher\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%F0%9F%93%8C_%E9%A2%84%E6%B5%8B%E6%80%A7%E8%BF%94%E5%9B%9E%E7%9A%84%E6%B5%8B%E8%AF%95%E6%96%B9%E6%B3%95\"><\/span><strong>\ud83d\udccc \u9884\u6d4b\u6027\u8fd4\u56de\u7684\u6d4b\u8bd5\u65b9\u6cd5<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li>\u4f7f\u7528 Android Studio Giraffe \u6216 Hedgehog \u4ee5\u4e0a\u7248\u672c\u7684\u6a21\u62df\u5668\u3002<\/li>\n\n\n\n<li>\u6a21\u62df\u5668\u9700\u8fd0\u884c Android 14\uff08API 34\uff09\u3002<\/li>\n\n\n\n<li>\u5728\u8bbe\u7f6e\u4e2d\u5f00\u542f\u9884\u6d4b\u6027\u8fd4\u56de\u52a8\u753b\uff1a Settings &gt; System &gt; Developer options &gt; Predictive back animations\u3002<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%F0%9F%9A%AB_%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98\"><\/span><strong>\ud83d\udeab \u5e38\u89c1\u95ee\u9898<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u52a8\u753b\u4e0d\u751f\u6548<\/strong>\uff1f \u2192 \u68c0\u67e5\u662f\u5426\u5728 Android 14 \u6a21\u62df\u5668\u4e0a\u8fd0\u884c\u3002<\/li>\n\n\n\n<li><strong>Fragment \u4e0d\u54cd\u5e94\u8fd4\u56de\u624b\u52bf\uff1f<\/strong> \u2192 \u68c0\u67e5\u662f\u5426\u6b63\u786e\u8bbe\u7f6e\u4e86 enableOnBackInvokedCallback\u3002<\/li>\n\n\n\n<li><strong>\u4f7f\u7528 Compose\uff1f<\/strong> \u2192 Compose \u7684 BottomSheet \u4f7f\u7528\u7684\u662f\u4e0d\u540c\u7684\u5b9e\u73b0\uff0c\u9700\u8981\u5355\u72ec\u5904\u7406\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u5728 Material3 \u4e2d\uff0cBottomSheetDialogFragment\uff08\u901a\u5e38\u7ee7\u627f\u81ea com.google.android.material.bottomsheet.BottomSheetDialogFragment\uff09\u9ed8\u8ba4\u662f\u652f\u6301\u9884\u6d4b\u6027\u8fd4\u56de\uff08Predictive Back\uff09\u7684\uff0c\u4f46\u8981\u8ba9\u5b83\u771f\u6b63\u4e0e Android 14\uff08API 34\uff09\u4e0a\u7684\u9884\u6d4b\u6027\u8fd4\u56de\u52a8\u753b\u534f\u4f5c\u826f\u597d\uff0c\u8fd8\u9700\u8981\u786e\u4fdd\u51e0\u4e2a\u5173\u952e\u70b9\u90fd\u6ee1\u8db3\u3002 \u4e0b\u9762\u662f\u5b9e\u73b0\u9884\u6d4b\u6027\u8fd4\u56de\u7684\u5177\u4f53\u6b65\u9aa4\u548c\u6ce8\u610f\u4e8b\u9879\uff1a \u2705 1.\u00a0\u4f7f\u7528\u652f\u6301\u9884\u6d4b\u6027\u8fd4\u56de\u7684 Android \u7248\u672c \u9884\u6d4b\u6027\u8fd4\u56de\u52a8\u753b\u662f\u4ece Android 13\uff08\u90e8\u5206\u652f\u6301\uff09\u548c Android 14\uff08\u5168\u9762\u652f\u6301\uff09\u5f00\u59cb\u5f15\u5165\u7684\uff0c\u6240\u4ee5\u8981\u6d4b\u8bd5\u5b83\u9700\u8981\u8fd0\u884c\u5728 Android 14+ \u7684\u8bbe\u5907\u6216\u6a21\u62df\u5668\u4e0a\u3002 \u2705 2.\u00a0\u4f7f\u7528 Material3 \u548c\u6700\u65b0\u4f9d\u8d56 \u786e\u4fdd\u4f60\u7684 material \u7ec4\u4ef6\u5e93\u662f 1.9.0 \u4ee5\u4e0a\u7248\u672c\uff08\u63a8\u8350\u4f7f\u7528\u6700\u65b0\uff09\uff1a \u2705 3.\u00a0\u4e3a BottomSheetDialogFragment \u8bbe\u7f6e\u5408\u9002\u7684 theme Material3 \u7684 BottomSheet \u9ed8\u8ba4\u5df2\u7ecf\u96c6\u6210\u4e86\u9884\u6d4b\u6027\u8fd4\u56de\u652f\u6301\uff0c\u4f46\u4f60\u8981\u786e\u4fdd\u5b83\u4f7f\u7528\u7684\u662f Material3 \u4e3b\u9898\uff0c\u6bd4\u5982\uff1a \u5728 Fragment \u4e2d\u4f7f\u7528\uff1a \u2705 4.\u00a0\u542f\u7528 Activity \u7ea7\u522b\u7684\u9884\u6d4b\u6027\u8fd4\u56de\u652f\u6301 \u786e\u4fdd\u4f60\u7684 Activity \u5f00\u542f\u4e86\u8fd9\u4e2a\u7279\u6027\uff1a AndroidManifest.xml \u4e2d\u8bbe\u7f6e\uff1a \u6216\u8005\u5355\u72ec\u5728 Activity \u4e0a\u8bbe\u7f6e\uff1a \u2705 5.\u00a0\u5b9e\u73b0\u9884\u6d4b\u6027\u8fd4\u56de\u56de\u8c03\uff08\u53ef\u9009\uff09 \u4ece Android 13\uff08API 33\uff09\u8d77\uff0c\u53ef\u4ee5\u901a\u8fc7 OnBackInvokedDispatcher \u6ce8\u518c\u8fd4\u56de\u4e8b\u4ef6\u56de\u8c03\uff1a \u8fd9\u4e2a\u901a\u5e38\u4e0d\u9700\u8981\u5199\uff0c\u9664\u975e\u4f60\u6709\u81ea\u5b9a\u4e49\u7684\u8fd4\u56de\u5904\u7406\u903b\u8f91\u3002 \u2705 6.\u00a0\u9002\u914d Navigation Component\uff08\u5982\u6709\uff09 \u5982\u679c\u4f60\u4f7f\u7528 Jetpack Navigation \u6765\u7ba1\u7406 Fragment \u6808\uff0c\u4e5f\u9700\u8981\u8ba9 Navigation \u652f\u6301 OnBackPressedDispatcher \u6216 OnBackInvokedDispatcher\u3002 \ud83d\udccc \u9884\u6d4b\u6027\u8fd4\u56de\u7684\u6d4b\u8bd5\u65b9\u6cd5 \ud83d\udeab \u5e38\u89c1\u95ee\u9898<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[58],"class_list":["post-477","post","type-post","status-publish","format-standard","hentry","category-appdev","tag-android"],"_links":{"self":[{"href":"https:\/\/trantor.ink\/index.php?rest_route=\/wp\/v2\/posts\/477","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/trantor.ink\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/trantor.ink\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/trantor.ink\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/trantor.ink\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=477"}],"version-history":[{"count":2,"href":"https:\/\/trantor.ink\/index.php?rest_route=\/wp\/v2\/posts\/477\/revisions"}],"predecessor-version":[{"id":479,"href":"https:\/\/trantor.ink\/index.php?rest_route=\/wp\/v2\/posts\/477\/revisions\/479"}],"wp:attachment":[{"href":"https:\/\/trantor.ink\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=477"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/trantor.ink\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=477"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/trantor.ink\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=477"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}