{"id":12267,"date":"2022-11-24T11:49:52","date_gmt":"2022-11-24T03:49:52","guid":{"rendered":"https:\/\/www.yimenapp.com\/kb-yimen\/?p=12267"},"modified":"2022-11-24T11:50:09","modified_gmt":"2022-11-24T03:50:09","slug":"%e5%b0%8f%e7%b1%b3%e6%89%8b%e6%9c%ba-miui-10-%e9%80%9a%e7%9f%a5%e6%a0%b7%e5%bc%8f%e5%8f%8a%e8%83%bd%e5%8a%9b%e9%80%82%e9%85%8d%e8%af%b4%e6%98%8e","status":"publish","type":"post","link":"https:\/\/www.yimenapp.com\/kb-yimen\/12267\/","title":{"rendered":"\u5c0f\u7c73\u624b\u673a MIUI 10 \u901a\u77e5\u6837\u5f0f\u53ca\u80fd\u529b\u9002\u914d\u8bf4\u660e"},"content":{"rendered":"\n<p>\u5c0f\u7c73\u624b\u673a <span class=\"wpcom_tag_link\"><a href=\"https:\/\/www.yimenapp.com\/kb-yimen\/tag\/miui-10\/\" title=\"MIUI 10\" target=\"_blank\">MIUI 10<\/a><\/span> \u901a\u77e5\u6837\u5f0f\u53ca\u80fd\u529b\u9002\u914d\u8bf4\u660e<\/p>\n\n\n\n<p>MIUI 10 \u901a\u77e5\u680f\u57fa\u4e8e <span class=\"wpcom_tag_link\"><a href=\"https:\/\/www.yimenapp.com\/kb-yimen\/tag\/android-o\/\" title=\"Android O\" target=\"_blank\">Android O<\/a><\/span> \u505a\u4e86\u91cd\u6784\uff0c\u5927\u5927\u589e\u5f3a\u4e86\u901a\u77e5\u680f\u7684\u80fd\u529b\uff0c\u5206\u522b\u662f\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u652f\u6301 6 \u79cd\u901a\u77e5\u6837\u5f0f<\/li><li>\u652f\u6301 <span class=\"wpcom_tag_link\"><a href=\"https:\/\/www.yimenapp.com\/kb-yimen\/tag\/large-icon\/\" title=\"Large icon\" target=\"_blank\">Large icon<\/a><\/span><\/li><li>\u652f\u6301 <span class=\"wpcom_tag_link\"><a href=\"https:\/\/www.yimenapp.com\/kb-yimen\/tag\/actions\/\" title=\"Actions\" target=\"_blank\">Actions<\/a><\/span><\/li><li>\u652f\u6301\u5feb\u6377\u56de\u590d&nbsp;(Direct&nbsp;reply)&nbsp;<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"_0\">1. \u524d\u8a00<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>\u4ee5\u4e0b\u56fe\u7247\uff0c\u4ec5\u7528\u4e8e\u793a\u610f\uff0c\u7ebf\u4e0a\u6548\u679c\u53ef\u80fd\u4f1a\u6709\u53d8\u5316\uff0c\u8bf7\u5728\u6700\u65b0 MIUI \u7248\u672c\u4e2d\u6d4b\u8bd5\u6837\u5f0f\u53ca\u903b\u8f91\u3002<\/li><li>\u4ee5\u4e0b\u56fe\u7247\u793a\u4f8b\u7684\u90fd\u662f MIUI 10 \u56fd\u5185\u7248\u7684\u6548\u679c\uff0c\u56fd\u9645\u7248\u7684\u5e03\u5c40\u5c06\u4f1a\u6cbf\u7528\u539f\u751f <span class=\"wpcom_tag_link\"><a href=\"https:\/\/www.yimenapp.com\/kb-yimen\/tag\/android\/\" title=\"Android\" target=\"_blank\">Android<\/a><\/span> \u7684\u6837\u5f0f\u3002<\/li><li>\u4ee5\u4e0b\u7279\u6027\uff0c\u5168\u90e8\u9700\u8981\u5f00\u53d1\u8005\u81ea\u884c\u9002\u914d\u3002\u901a\u77e5\u680f\u53ea\u662f\u63d0\u4f9b\u57fa\u7840\u80fd\u529b\uff0c \u4f46\u662f\u5426\u4f7f\u7528\u7531\u5f00\u53d1\u8005\u51b3\u5b9a\u3002<\/li><li>\u4ee5\u4e0b\u63d0\u53ca\u7684\u63a5\u53e3\u5747\u4e3a Android \u6807\u51c6\u63a5\u53e3\uff0c\u53ef\u5728\u5b98\u65b9\u6587\u6863\u4e2d\u67e5\u8be2\uff0c\u4f46\u4e5f\u8981\u6ce8\u610f\u662f\u4ece\u54ea\u4e2a Android \u7248\u672c\u5f00\u59cb\u652f\u6301\u3002<\/li><li>\u5bf9\u4e8e\u4f7f\u7528\u63a8\u9001\u901a\u9053\u7684\u5f00\u53d1\u8005\uff0c\u9700\u8981\u786e\u8ba4\u76f8\u5173\u63a8\u9001\u901a\u9053\u662f\u5426\u652f\u6301\u4ee5\u4e0b\u80fd\u529b\u53ca\u76f8\u5173\u6807\u51c6\u63a5\u53e3\uff0c\u82e5\u4e0d\u652f\u6301\uff0c\u5219\u65e0\u6cd5\u4f7f\u7528\u76f8\u5173\u80fd\u529b\u3002<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"_1\">2. \u516d\u79cd\u901a\u77e5\u6837\u5f0f (template)<\/h2>\n\n\n\n<p>\u539f\u751f Android O \u652f\u63016\u79cd\u901a\u77e5\u6837\u5f0f\uff08\u6216\u79f0 template\uff09\uff0cMIUI 10 \u4e5f\u5c06\u5b8c\u5168\u517c\u5bb9\u8fd9\u4e9b\u6837\u5f0f\u3002<\/p>\n\n\n\n<p>\uff08\u5173\u4e8e\u539f\u751f Android O \u7684\u901a\u77e5\u6837\u5f0f\u4ecb\u7ecd\uff0c\u8be6\u89c1&nbsp;<a href=\"https:\/\/material.io\/design\/platform-guidance\/android-notifications.html#templates\">https:\/\/material.io\/design\/platform-guidance\/android-notifications.html#templates<\/a>&nbsp;\uff09<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"_1_0\">2.1. \u6807\u51c6\u6837\u5f0f (Standard template)<\/h3>\n\n\n\n<p>\u6807\u51c6\u6837\u5f0f\u662f\u6700\u5e38\u89c1\u7684\u6837\u5f0f\uff0c\u4e5f\u662f\u901a\u77e5\u680f\u7684\u9ed8\u8ba4\u6837\u5f0f\uff0c\u6709\u4ee5\u4e0b\u7279\u70b9\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u4e00\u822c\u5305\u542b\u201c\u6807\u9898\u201d\u3001\u201c\u5185\u5bb9\u201d\u3001\u201c\u56fe\u6807\u201d\u3001\u201c\u65f6\u95f4\u6233\u201d4\u4e2a\u5143\u7d20<\/li><li>\u4e00\u822c\u65e0\u5927\u89c6\u56fe<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/kb.cdn.yimenapp.com\/yimen\/2022\/11\/20221124114952116.png\" alt=\"\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"_1_1\">2.2. \u5927\u6587\u672c\u6837\u5f0f (Big text template)<\/h3>\n\n\n\n<p>\u81ea API 16 (Android 4.1) \u5f15\u5165\uff0c\u7528\u4ee5\u5c55\u793a\u66f4\u591a\u7684\u6587\u672c\u5185\u5bb9\uff0c\u6709\u4ee5\u4e0b\u7279\u70b9\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u6709\u6807\u51c6\u89c6\u56fe&nbsp;(standard view)\uff0c\u770b\u8d77\u6765\u4e0e\u6807\u51c6\u6837\u5f0f (Standard&nbsp;template) \u4e00\u6837\u3002<\/li><li>\u6709\u5927\u89c6\u56fe (expanded view)\uff0c\u6709\u66f4\u5927\u7684\u9762\u79ef\uff0c\u5141\u8bb8\u5c55\u793a\u66f4\u591a\u7684\u5185\u5bb9\u3002<\/li><li>\u901a\u8fc7\u957f\u6309\u901a\u77e5\u6765\u5207\u6362\u6807\u51c6\u89c6\u56fe\u548c\u5927\u89c6\u56fe\u3002<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/kb.cdn.yimenapp.com\/yimen\/2022\/11\/20221124114953909.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u4ee3\u7801\u793a\u4f8b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Notification notif = <strong>new<\/strong> Notification.Builder(mContext)\n   .setContentTitle(\"\u7279\u65af\u62c9\u53ec\u56de\u4e24\u5343\u4f59\u8f86 ModelX\")\n   .setContentText(\"\u672c\u6b21\u53ec\u56de\u8303\u56f4\u4ec5\u9650\u90e8\u5206\u8f66\u8f86\")\n   .setSmallIcon(R.drawable.ic_phonelink_ring_primary_24dp)\n   .setColor(ContextCompat.getColor(context, R.color.primary_light))\n   .setPriority(Notification.PRIORITY_MAX)\n   .setVibrate(<strong>new<\/strong> <strong>long<\/strong>&#91;0])\n   .setStyle(<strong>new<\/strong> Notification.BigTextStyle()\n       .bigText(\"\u636e\u4e0a\u5468\u7f8e\u8054\u793e\u4fe1\u606f\u62a5\u9053\uff0c\u7279\u65af\u62c9\u5df2\u5ba3\u5e03\u8ba1\u5212\u5728\u5168\u7403\u8303\u56f4\u5185\u53ec\u56de\u5927\u7ea61.1\u4e07\u8f86ModelXSUV\uff0c\u539f\u56e0\u662f\u540e\u5ea7\u53ef\u80fd\u65e0\u6cd5\u9501\u5b9a\u3002\"))\n   .build();<\/code><\/pre>\n\n\n\n<p>\u8be5\u6837\u5f0f\u8fd8\u6709\u66f4\u591a\u7684\u63a5\u53e3\u4f9b\u5f00\u53d1\u8005\u4f7f\u7528\uff0c\u8be6\u89c1\u5b98\u65b9\u6587\u6863&nbsp;<a href=\"https:\/\/developer.android.com\/reference\/android\/app\/Notification.BigTextStyle\">https:\/\/developer.android.com\/reference\/android\/app\/Notification.BigTextStyle\u3002<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"_1_2\">2.3. \u5927\u56fe\u6837\u5f0f (Big picture template)<\/h3>\n\n\n\n<p>\u81ea API 16 (Android 4.1) \u5f15\u5165\uff0c\u7528\u4ee5\u5728\u901a\u77e5\u91cc\u5c55\u793a\u5927\u56fe\uff0c\u9002\u7528\u4e8e\u5bcc\u5a92\u4f53\u7684\u5185\u5bb9\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u6709\u6807\u51c6\u89c6\u56fe&nbsp;(standard view)\uff0c\u770b\u8d77\u6765\u4e0e\u6807\u51c6\u6837\u5f0f (Standard&nbsp;template) \u4e00\u6837\u3002<\/li><li>\u6709\u5927\u89c6\u56fe (expanded view)\uff0c\u652f\u6301\u5c55\u793a\u4e00\u5f20\u5927\u56fe\uff0c\u4f46\u65e0\u6cd5\u4e0eBig text template \u5171\u7528\uff0c\u5373\u65e0\u6cd5\u5c55\u793a\u957f\u6587\u672c\u3002<\/li><li>\u901a\u8fc7\u957f\u6309\u901a\u77e5\u6765\u5207\u6362\u6807\u51c6\u89c6\u56fe\u548c\u5927\u89c6\u56fe\u3002<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/kb.cdn.yimenapp.com\/yimen\/2022\/11\/20221124114953756.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u4ee3\u7801\u793a\u4f8b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Notification notif = <strong>new<\/strong> Notification.Builder(mContext)\n    .setContentTitle(\"Unsplash Curation\")\n    .setContentText(\"The best new high-res photos from Unsplash. Here\u2019s a few of our team\u2019s favourites from today.\")\n    .setSmallIcon(R.drawable.new_post)\n    .setStyle(<strong>new<\/strong> Notification.BigPictureStyle()\n        .bigPicture(aBigBitmap))\n    .build();<\/code><\/pre>\n\n\n\n<p>\u66f4\u591a\u7684\u63a5\u53e3\u8be6\u89c1\u5b98\u65b9\u6587\u6863&nbsp;<a href=\"https:\/\/developer.android.com\/reference\/android\/app\/Notification.BigPictureStyle\">https:\/\/developer.android.com\/reference\/android\/app\/Notification.BigPictureStyle<\/a>\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"_1_3\">2.4. \u8fdb\u5ea6\u6761\u6837\u5f0f (Progress template)<\/h3>\n\n\n\n<p>\u81ea API 14 (Android 4.0) \u5f15\u5165\uff0c\u6709\u4ee5\u4e0b\u7279\u70b9\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u7c7b\u578b1\uff1a\u201c\u65e0\u660e\u786e\u8fdb\u5ea6 (indeterminate)\u201d\uff0c\u5373\u65e0\u6cd5\u9884\u4f30\u7ed3\u675f\u65f6\u95f4\uff0c\u7c7b\u4f3c\u4e8e loading \u52a8\u753b\u3002<\/li><li>\u7c7b\u578b2\uff1a\u201c\u6709\u660e\u786e\u8fdb\u5ea6 (determinate)\u201d\uff0c\u53ef\u4ee5\u9884\u4f30\u7ed3\u675f\u65f6\u95f4\u3002<\/li><li>\u652f\u6301\u6807\u51c6\u89c6\u56fe (standard view)\uff0c\u7c7b\u4f3c\u6807\u51c6\u6837\u5f0f\u52a0\u4e0a\u4e86\u8fdb\u5ea6\u6761\u3002<\/li><li>\u652f\u6301\u5927\u89c6\u56fe (expanded view)\uff0c\u4e00\u822c\u662f\u5c55\u793a\u6309\u94ae\uff0c\u5982\u300c\u53d6\u6d88\u300d\u3002<\/li><li>\u8fdb\u5ea6\u6761\u6837\u5f0f\u53ef\u4ee5\u548c Big text\u3001Big picture \u6df7\u7528\uff08\u7559\u5f85\u5404\u4f4d\u5c1d\u8bd5\uff09<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/kb.cdn.yimenapp.com\/yimen\/2022\/11\/20221124114956690.png\" alt=\"\"\/><\/figure>\n\n\n\n<p><strong>\u4ee3\u7801\u793a\u4f8b\uff1a<\/strong><\/p>\n\n\n\n<p>\u4ee3\u7801\u5c42\u9762\u4e0a\uff0cProgress template \u5e76\u4e0d\u662f\u4e00\u79cd&nbsp;Style\uff0c\u65e0\u6cd5\u901a\u8fc7&nbsp;<a href=\"https:\/\/developer.android.com\/reference\/android\/app\/Notification.Builder#setstyle\">setStyle<\/a>&nbsp;\u6765\u8bbe\u7f6e\uff0c\u800c\u662f\u901a\u8fc7&nbsp;<a href=\"https:\/\/developer.android.com\/reference\/android\/app\/Notification.Builder#setProgress(int,%20int,%20boolean)\">setProgress<\/a>&nbsp;\u6765\u914d\u7f6e\uff0c\u56e0\u6b64\u624d\u53ef\u4ee5\u548c Big text\u3001Big picture \u6df7\u7528\u3002<\/p>\n\n\n\n<p>\u4ee5\u4e0b\u662f\u4e24\u79cd\u8fdb\u5ea6\u7c7b\u578b\u7684\u4ee3\u7801\u793a\u4f8b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#\u7c7b\u578b1\uff1aindeterminate\nNotification notif = <strong>new<\/strong> Notification.Builder(mContext)\n    .setContentTitle(\"\u6b63\u5728\u4e0b\u8f7d\u5b89\u88c5\u5305\")\n    .setContentText(\"\u5373\u5c06\u66f4\u65b0\u81f3 MIUI 10\")\n    .setSmallIcon(R.drawable.ic_phonelink_ring_primary_24dp)\n    .setProgress(100,50,<strong>true<\/strong>)\n    .addAction(cancelAction)\n    .build();<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>#\u7c7b\u578b2\uff1adeterminate\nNotification notif = <strong>new<\/strong> Notification.Builder(mContext)\n    .setContentTitle(\"\u6b63\u5728\u4e0b\u8f7d\u5b89\u88c5\u5305\")\n    .setContentText(\"\u4e0b\u8f7d\u8fdb\u5ea635%\")\n    .setSubText(\"\u8fd8\u670927\u5206\u949f\")\n    .setSmallIcon(R.drawable.ic_phonelink_ring_primary_24dp)\n    .setProgress(100,35,<strong>false<\/strong>)\n    .addAction(cancelAction)\n    .build();<\/code><\/pre>\n\n\n\n<p>\u66f4\u8be6\u7ec6\u7684\u5b9e\u73b0\u8bf4\u660e\uff0c\u4e5f\u53ef\u4ee5\u770b\u5b98\u65b9\u6587\u6863&nbsp;<a href=\"https:\/\/developer.android.com\/training\/notify-user\/build-notification#progressbar\">https:\/\/developer.android.com\/training\/notify-user\/build-notification#progressbar\u3002<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"_1_4\">2.5. \u5a92\u4f53\u6837\u5f0f (Media template)<\/h3>\n\n\n\n<p>\u81ea API 21 (Android 5.0) \u5f15\u5165\uff0c\u4e3a\u97f3\u4e50\u3001\u5e7f\u64ad\u7b49\u5a92\u4f53\u64ad\u653e\u8bbe\u8ba1\u7684\u901a\u77e5\u6837\u5f0f\uff0c\u8be6\u7ec6\u4ecb\u7ecd\u89c1\u8fd9\u4e2a\u6587\u6863&nbsp;<a href=\"https:\/\/dev.mi.com\/console\/doc\/detail?pId=1300\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/dev.mi.com\/console\/doc\/detail?pId=1300<\/a>&nbsp;\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"_1_5\">2.6. \u5bf9\u8bdd\u6837\u5f0f (Messaging template)<\/h3>\n\n\n\n<p>\u81ea API 24 (Android 7.0) \u5f15\u5165\uff0c\u4e3a\u5bf9\u8bdd\u5f0f\u5185\u5bb9\u8bbe\u8ba1\u7684\u901a\u77e5\u6837\u5f0f\uff0c\u9002\u7528\u4e8e IM \/ \u90ae\u4ef6\u7b49\u6d89\u53ca\u4f1a\u8bdd\u7684\u5e94\u7528\u3002\u6709\u4ee5\u4e0b\u7279\u70b9\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u652f\u6301\u5355\u804a\u548c\u7fa4\u804a\u4e24\u79cd\u4f1a\u8bdd\u6a21\u5f0f\u3002<\/li><li>\u652f\u6301\u666e\u901a\u89c6\u56fe (standard view)\uff0c\u7c7b\u4f3c\u6807\u51c6\u6837\u5f0f\u3002<\/li><li>\u652f\u6301\u5927\u89c6\u56fe (expanded view)\uff0c\u652f\u6301\u663e\u793a\u4f1a\u8bdd\u7684\u4e0a\u4e0b\u6587\u3002<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/kb.cdn.yimenapp.com\/yimen\/2022\/11\/20221124114956902.png\" alt=\"\"\/><\/figure>\n\n\n\n<p><strong>\u4ee3\u7801\u793a\u4f8b\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#\u7c7b\u578b1\uff1a\u5355\u804a\nNotification notif = <strong>new<\/strong> Notification.Builder()\n    .setSmallIcon(R.drawable.ic_phonelink_ring_primary_24dp)\n    .setLargeIcon(userAvatar)\n    .setStyle(<strong>new<\/strong> MessagingStyle(\"\u6211\")\n            .addMessage(\"\u7231\u4e50\u4e4b\u57ce\u600e\u4e48\u6837\", 1, \"\u6211\")\n            .addMessage(\"\u5f88\u4e0d\u9519\u554a\uff0c\u91d1\u7403\u5956\u5f97\u4e3b\u5462\", 2, \"\u97e9\u6885\u6885\")\n            .addMessage(\"\u4ec0\u4e48\u65f6\u5019\u4e0a\u6620\u7684\uff1f\u6700\u8fd1\u8001\u5728\u522b\u7684\u5730\u65b9\u770b\u5230\u8fd9\u4e2a\u7535\u5f71\u7684\u4ecb\u7ecd\uff0c\u88ab\u540a\u8d77\u80c3\u53e3\u4e86\", 3, \"\u6211\")\n            .addMessage(\"\u4e2d\u56fd\u8981\u60c5\u4eba\u8282\u624d\u4e0a\u6620\", 4, \"\u97e9\u6885\u6885\"))\n    .addAction(replyAction)\n    .build();<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>#\u7c7b\u578b2\uff1a\u7fa4\u804a\nNotification notif = <strong>new<\/strong> Notification.Builder()\n    .setSmallIcon(R.drawable.ic_phonelink_ring_primary_24dp)\n    .setLargeIcon(groupAvatar)\n    .setStyle(<strong>new<\/strong> MessagingStyle(\"\u6211\")\n        .setConversationTitle(\"\u8fd9\u91cc\u662f\u7fa4\u804a\u540d\u79f0\")\n        .addMessage(\"\u5a01\u5c113\u828241\u5206\u4e5f\u662f666\", 1, \"winson\")\n        .addMessage(\"\u843d\u540e\u597d\u591a\u54a7\", 2, \"\u8d85\")\n        .addMessage(\"\u5176\u4ed6\u7684\u4e0d\u7ed9\u529b\", 3, \"winson\")\n        .addMessage(\"\u52c7\u58eb\u8d62\u662f\u6b63\u5e38\uff0c\u4f46\u8fd9\u4e0d\u662f\u4e00\u573a\u666e\u901a\u7684\u6bd4\u8d5b\u4e86\uff0c\u5927\u5bb6\u90fd\u6253\u51fa\u706b\u6c14\u6765\u4e86\", 4, \"\u6211\"))\n    .addAction(replyAction)\n    .build();<\/code><\/pre>\n\n\n\n<p>\u66f4\u591a\u7684\u63a5\u53e3\u8be6\u89c1\u5b98\u65b9\u6587\u6863&nbsp;<a href=\"https:\/\/developer.android.com\/reference\/android\/app\/Notification.MessagingStyle\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/developer.android.com\/reference\/android\/app\/Notification.MessagingStyle<\/a>\u3002<\/p>\n\n\n\n<p>\u4e0a\u9762\u7684\u4f8b\u5b50\uff0c\u5927\u5bb6\u5e94\u8be5\u6ce8\u610f\u5230&nbsp;<a href=\"https:\/\/developer.android.com\/reference\/android\/app\/Notification.Builder#setlargeicon_6\">setLargeIcon<\/a>&nbsp;\u548c&nbsp;<a href=\"https:\/\/developer.android.com\/reference\/android\/app\/Notification.Builder#addaction_4\">addAction<\/a>&nbsp;\u8fd9\u4e24\u4e2a\u65b9\u6cd5\uff0c\u8fd9\u662f\u7528\u6765\u663e\u793a\u300c\u7528\u6237\u5934\u50cf\u300d\u548c\u300c\u56de\u590d\u300d\u6309\u94ae\u7684\u65b9\u6cd5\u3002\u4f46\u8fd9\u4e24\u4e2a\u65b9\u6cd5\uff0c\u4e0d\u9650\u4e8e Messaging template\uff0c\u53ef\u7528\u4e8e\u6240\u6709\u901a\u77e5\u6837\u5f0f\u4e2d\uff0c\u4e0b\u9762\u5c06\u4ed4\u7ec6\u8bf4\u660e\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"_2\">3. \u652f\u6301 Large icon\uff08\u6d4b\u8bd5\u6027\u529f\u80fd\uff09<\/h2>\n\n\n\n<p>Android \u901a\u77e5\u9ed8\u8ba4\u6ca1\u6709 large icon\uff0c\u4f46\u5f00\u53d1\u8005\u53ef\u4ee5\u901a\u8fc7&nbsp;<a href=\"https:\/\/developer.android.com\/reference\/android\/app\/Notification.Builder#setLargeIcon(android.graphics.Bitmap)\" target=\"_blank\" rel=\"noreferrer noopener\">setLargeIcon<\/a>&nbsp;\u65b9\u6cd5 (\u81ea API 11 &#8211; Android 3.0 \u5f15\u5165) \u7ed9\u901a\u77e5\u589e\u52a0 large icon\uff0c\u4e30\u5bcc\u901a\u77e5\u7684\u5185\u5bb9\uff0c\u5c24\u5176\u9002\u7528\u4e8e IM \/ \u90ae\u4ef6\u7b49\u573a\u666f\u3002<\/p>\n\n\n\n<p>\u81ea MIUI 10 \u5f00\u59cb\uff0cMIUI \u901a\u77e5\u680f\u6b63\u5f0f\u652f\u6301\u663e\u793a large icon\uff0c\u793a\u4f8b\u6548\u679c\u5982\u4e0b\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/kb.cdn.yimenapp.com\/yimen\/2022\/11\/20221124114959988.png\" alt=\"\"\/><\/figure>\n\n\n\n<p><strong>\u4ee3\u7801\u793a\u4f8b\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Notification notif = <strong>new<\/strong> Notification.Builder()\n    .setContentTitle(\"\u97e9\u6885\u6885\")\n    .setContentText(\"\u4e2d\u56fd\u8981\u60c5\u4eba\u8282\u624d\u4e0a\u6620\")\n    .setSmallIcon(R.drawable.ic_chat_black_24dp)\n    .setLargeIcon(userAvatar)\n    .build();<\/code><\/pre>\n\n\n\n<p>\u672a\u8bbe\u7f6elarge icon\u65f6\uff0c\u4f1a\u9ed8\u8ba4\u7528\u5e94\u7528\u684c\u9762\u56fe\u6807\u4ee3\u66ff\u3002\u6709\u51e0\u70b9\u503c\u5f97\u8bf4\u660e\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/developer.android.com\/reference\/android\/app\/Notification.Builder#setlargeicon_6\">setLargeIcon<\/a>&nbsp;\u65b9\u6cd5\u9002\u7528\u4e8e\u6240\u6709<a href=\"http:\/\/wiki.n.miui.com\/pages\/editpage.action?pageId=86395268\">\u901a\u77e5\u6837\u5f0f<\/a>\uff0c\u4e0d\u9650\u4e8e\u4e0a\u8ff0\u4f8b\u5b50\u3002\u5f00\u53d1\u8005\u53ef\u4ee5\u914d\u5408&nbsp;<a href=\"https:\/\/developer.android.com\/reference\/android\/app\/Notification.Builder#setstyle\">setStyle<\/a>&nbsp;\u65b9\u6cd5\uff0c\u7075\u6d3b\u642d\u914d\u4e0d\u540c\u7684\u6837\u5f0f\u3002<\/li><li>MIUI \u7cfb\u7edf\u4f1a\u81ea\u52a8\u5728 large icon \u7684\u53f3\u4e0b\u89d2\u6dfb\u52a0\u5e94\u7528 icon\uff0c\u4ee5\u6807\u793a\u8be5\u901a\u77e5\u7684\u6765\u6e90\u3002\u56e0\u6b64\u4e0d\u8981\u628a large icon \u8bbe\u7f6e\u4e3a\u5e94\u7528\u56fe\u6807\u3002<\/li><li>\u8bf7\u4e0d\u8981\u6ee5\u7528 large icon\uff0c\u6211\u4eec\u540e\u7eed\u4f1a\u89c6\u60c5\u51b5\u800c\u5b9a\u662f\u5426\u6536\u7d27\u8fd9\u4e2a\u80fd\u529b\u3002<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"_3\">4. \u652f\u6301 Actions<\/h2>\n\n\n\n<p>Actions \u6307\u7684\u662f\u901a\u77e5\u7684\u5feb\u6377\u6309\u94ae\uff0c\u8be5\u7279\u6027\u81ea API 16 (Android 4.1) \u5f15\u5165\uff0c\u5e76\u5728 API 20 (Android 4.4W) \u4e2d\u66f4\u65b0\u3002<\/p>\n\n\n\n<p>\u5728 MIUI 10\uff0cActions \u7684\u6837\u5f0f\u5982\u4e0b\uff08\u9664\u5a92\u4f53\u901a\u77e5\u5916\uff0c\u6700\u591a\u53ef\u4ee5\u8bbe\u7f6e3\u4e2a Actions\uff09\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/kb.cdn.yimenapp.com\/yimen\/2022\/11\/20221124114959151.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u6709\u51e0\u70b9\u503c\u5f97\u8bf4\u660e\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u9ed8\u8ba4\u4e0d\u4f1a\u6709 Actions\uff0c\u9700\u8981\u5f00\u53d1\u8005\u901a\u8fc7&nbsp;<a href=\"https:\/\/developer.android.com\/reference\/android\/app\/Notification.Builder#addaction_4\">addAction<\/a>&nbsp;\u4e3b\u52a8\u58f0\u660e\u3002<\/li><li>\u4efb\u4f55\u901a\u77e5\u6837\u5f0f\u90fd\u53ef\u4ee5\u6dfb\u52a0 Actions\uff08\u6548\u679c\u5982\u4e0b\u56fe\uff09\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u81ea\u7531\u642d\u914d<\/li><li>Actions \u53ea\u80fd\u5728\u5927\u89c6\u56fe\u65f6\u663e\u793a\uff0c\u5728 MIUI 10\uff0c\u9664\u4e86\u5a92\u4f53\u901a\u77e5\uff0c\u6240\u6709\u901a\u77e5\u9ed8\u8ba4\u5c55\u793a\u6807\u51c6\u89c6\u56fe\uff08\u6807\u51c6\u89c6\u56fe\u4e0d\u663e\u793a Actions \uff09\u3002<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/kb.cdn.yimenapp.com\/yimen\/2022\/11\/20221124115000708.png\" alt=\"\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"_4\">5. \u652f\u6301\u5feb\u6377\u56de\u590d (Direct reply)<\/h2>\n\n\n\n<p>\u5feb\u6377\u56de\u590d&nbsp;(Direct&nbsp;reply) \u662f Android 7.0 \u5f15\u5165\u7684\u65b0\u529f\u80fd\uff0c\u5f00\u53d1\u8005\u9002\u914d\u540e\uff0c\u53ef\u4ee5\u652f\u6301\u5728\u901a\u77e5\u680f\u76f4\u63a5\u56de\u590d\u6d88\u606f\uff0c\u800c\u4e0d\u7528\u8c03\u8d77\u5e94\u7528\uff0c\u793a\u610f\u56fe\u5982\u4e0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/kb.cdn.yimenapp.com\/yimen\/2022\/11\/20221124115004366.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>Direct reply \u4e5f\u4e0d\u9650\u901a\u77e5\u6837\u5f0f\uff08\u6548\u679c\u5982\u4e0b\u56fe\uff09\uff0c\u5f00\u53d1\u8005\u53ef\u4e0e\u4e0d\u540c\u7684\u901a\u77e5\u6837\u5f0f\u7ec4\u5408\u642d\u914d\u3002\u4f46 Direct reply \u4f9d\u8d56\u4e8e Actions\uff0c\u56e0\u6b64\u9700\u8981\u5148\u663e\u793a Actions\uff0c\u624d\u80fd\u89e6\u53d1 Direct reply\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/kb.cdn.yimenapp.com\/yimen\/2022\/11\/20221124115005995.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u5173\u4e8e Direct reply \u7684\u5b9e\u73b0\u65b9\u5f0f\uff0c\u53ef\u4ee5\u53c2\u8003\u4ee5\u4e0b\u8d44\u6599\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u5b98\u65b9\u6587\u6863&nbsp;<a href=\"https:\/\/developer.android.com\/training\/notify-user\/build-notification#reply-action\">https:\/\/developer.android.com\/training\/notify-user\/build-notification#reply-action<\/a><\/li><li>\u7b2c\u4e09\u65b9\u535a\u5ba2\uff1a<a href=\"https:\/\/segunfamisa.com\/posts\/notifications-direct-reply-android-nougat\">https:\/\/segunfamisa.com\/posts\/notifications-direct-reply-android-nougat<\/a><\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"_5\">6. FAQ<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"_5_0\">6.1. \u5982\u4f55\u5224\u65ad MIUI \u7248\u672c<\/h3>\n\n\n\n<p>\u6709\u4ee5\u4e0b\u65b9\u6cd5\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>android.os.SystemProperties.<strong>get<\/strong>(\"ro.miui.ui.version.code\",&nbsp;\"7\");<em>\/\/ \u5982\u679c\u8fd4\u56de\u503c\u662f\u300c8\u300d\uff0c\u5c31\u662f MIUI 10<\/em><\/code><\/pre>\n\n\n\n<p>\u6216<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>android.os.SystemProperties.<strong>get<\/strong>(\"ro.miui.ui.version.name\",&nbsp;\"\");<em>\/\/ \u5982\u679c\u8fd4\u56de\u503c\u662f\u300cV10\u300d\uff0c\u5c31\u662f MIUI 10<\/em><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"_5_1\">6.2. \u5982\u4f55\u6d4b\u8bd5<\/h3>\n\n\n\n<p>\u5347\u7ea7\u5230&nbsp; MIUI 10 \u6700\u65b0\u5f00\u53d1\u7248\u5373\u53ef\uff0c\u652f\u6301\u7684\u673a\u578b\u548c\u4e0b\u8f7d\u94fe\u63a5\u5982\u4e0b\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u56fd\u5185\u7248 ROM\uff1a<a href=\"http:\/\/www.miui.com\/zt\/miuirom\/download.php\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/www.miui.com\/zt\/miuirom\/download.php<\/a><\/li><li>\u56fd\u9645\u7248 ROM\uff1a<a href=\"http:\/\/en.miui.com\/download.html\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/en.miui.com\/download.html<\/a><\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>MIUI 10 \u901a\u77e5\u680f\u57fa\u4e8e Android O \u505a\u4e86\u91cd\u6784\uff0c\u5927\u5927\u589e\u5f3a\u4e86\u901a\u77e5\u680f\u7684\u80fd\u529b\uff0c\u5206\u522b\u662f\uff1a<\/p>\n","protected":false},"author":1,"featured_media":12268,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[46,94,160],"tags":[5745,465,5736,5746,5744,5722],"special":[66],"attr":[],"class_list":["post-12267","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-appsj","category-appjc","category-appcs","tag-actions","tag-android","tag-android-o","tag-direct-reply","tag-large-icon","tag-miui-10","special-vivokfpt","entry"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/posts\/12267","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/comments?post=12267"}],"version-history":[{"count":1,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/posts\/12267\/revisions"}],"predecessor-version":[{"id":12278,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/posts\/12267\/revisions\/12278"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/media\/12268"}],"wp:attachment":[{"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/media?parent=12267"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/categories?post=12267"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/tags?post=12267"},{"taxonomy":"special","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/special?post=12267"},{"taxonomy":"attr","embeddable":true,"href":"https:\/\/www.yimenapp.com\/kb-yimen\/wp-json\/wp\/v2\/attr?post=12267"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}