{"id":316,"date":"2024-02-13T22:44:27","date_gmt":"2023-06-19T15:39:52","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/index.php\/2023\/11\/30\/%e5%9c%a8%e5%ba%94%e7%94%a8%e4%b8%ad%e4%bd%bf%e7%94%a8android-daynight%e4%b8%bb%e9%a2%98%e8%bf%9b%e8%a1%8c%e5%a4%9c%e9%97%b4%e6%a8%a1%e5%bc%8f\/"},"modified":"2025-08-01T21:33:05","modified_gmt":"2025-08-01T13:33:05","slug":"%e5%9c%a8%e5%ba%94%e7%94%a8%e4%b8%ad%e4%bd%bf%e7%94%a8android-daynight%e4%b8%bb%e9%a2%98%e8%bf%9b%e8%a1%8c%e5%a4%9c%e9%97%b4%e6%a8%a1%e5%bc%8f","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8%e5%ba%94%e7%94%a8%e4%b8%ad%e4%bd%bf%e7%94%a8android-daynight%e4%b8%bb%e9%a2%98%e8%bf%9b%e8%a1%8c%e5%a4%9c%e9%97%b4%e6%a8%a1%e5%bc%8f\/","title":{"rendered":"Android DayNight\u4e3b\u9898\u5b9e\u73b0\u5e94\u7528\u591c\u95f4\u6a21\u5f0f\u6559\u7a0b"},"content":{"rendered":"<p>\u5728\u672c\u6559\u7a0b\u4e2d\uff0c\u6211\u4eec\u5c06\u8ba8\u8bba\u5982\u4f55\u5728\u6211\u4eec\u7684\u5e94\u7528\u7a0b\u5e8f\u4e2d\u4f7f\u7528Android\u7684\u65e5\u591c\u4e3b\u9898\u3002\u5982\u679c\u60a8\u7684\u5e94\u7528\u7a0b\u5e8f\u5305\u542b\u9605\u8bfb\u6750\u6599\uff0c\u90a3\u4e48\u5177\u5907\u591c\u95f4\u6a21\u5f0f\u6709\u52a9\u4e8e\u51cf\u8f7b\u89c6\u89c9\u8d1f\u62c5\u3002<\/p>\n<h2>Android \u65e5\u591c\u4e3b\u9898<\/h2>\n<p>Android\u53d1\u5e03\u4e86\u4e00\u4e2a\u65b0\u7684\u4e3b\u9898\uff1aTheme.AppCompat.DayNight\uff0c\u652f\u6301\u5e93\u7248\u672c\u4e3a23.2.0\u3002\u6709\u4e86\u8fd9\u4e2a\u4e3b\u9898\uff0c\u6211\u4eec\u73b0\u5728\u53ef\u4ee5\u5728\u6211\u4eec\u7684\u5e94\u7528\u7a0b\u5e8f\u7684\u6d45\u8272\u548c\u6df1\u8272\u6a21\u5f0f\u4e4b\u95f4\u5207\u6362\u3002\u6211\u4eec\u53ef\u4ee5\u624b\u52a8\u5207\u6362\uff0c\u4e5f\u53ef\u4ee5\u8ba9Android\u6839\u636e\u624b\u673a\u81ea\u52a8\u68c0\u6d4b\u65e5\u671f\u548c\u65f6\u95f4\u6765\u5207\u6362\u3002\u8fd9\u4e2a\u4e3b\u9898\u901a\u8fc7\u5c06\u660e\u4eae\u7684\u767d\u8272\u80cc\u666f\u66ff\u6362\u4e3a\u8f83\u6697\u7684\u80cc\u666f\uff0c\u63d0\u5347\u4e86\u5e94\u7528\u7a0b\u5e8f\u5728\u591c\u95f4\u7684\u53ef\u8bfb\u6027\u548c\u53ef\u7528\u6027\u3002\u8bb8\u591a\u9605\u8bfb\u5e94\u7528\u7a0b\u5e8f\u5df2\u7ecf\u5728\u4ed6\u4eec\u7684\u5e94\u7528\u4e2d\u4f7f\u7528\u4e86\u8fd9\u4e2a\u4e3b\u9898\u3002\u8ba9\u6211\u4eec\u901a\u8fc7\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u7a7a\u6d3b\u52a8\u7684Android Studio\u9879\u76ee\u6765\u5f00\u59cb\u6211\u4eec\u7684\u5b9e\u73b0\u3002<\/p>\n<h3>\u5c06\u4e3b\u9898\u6dfb\u52a0\u5230\u6211\u4eec\u7684styles.xml\u6587\u4ef6\u4e2d<\/h3>\n<p>\u8ba9\u6211\u4eec\u5c06\u5e94\u7528\u7a0b\u5e8f\u4e2d\u5f53\u524d\u7684\u4e3b\u9898\u66ff\u6362\u4e3a DayNight \u4e3b\u9898\u3002<\/p>\n<pre class=\"post-pre\"><code>&lt;style name=\"AppTheme\" parent=\"Theme.AppCompat.DayNight\"&gt;\r\n        &lt;!-- \u5728\u6b64\u5904\u81ea\u5b9a\u4e49\u60a8\u7684\u4e3b\u9898 --&gt;\r\n        &lt;item name=\"colorPrimary\"&gt;@color\/colorPrimary&lt;\/item&gt;\r\n        &lt;item name=\"colorPrimaryDark\"&gt;@color\/colorPrimaryDark&lt;\/item&gt;\r\n        &lt;item name=\"colorAccent\"&gt;@color\/colorAccent&lt;\/item&gt;\r\n    &lt;\/style&gt;\r\n<\/code><\/pre>\n<p>\u4e3a\u4e86\u5728\u6211\u4eec\u7684\u5e94\u7528\u7a0b\u5e8f\u4e2d\u8bbe\u7f6eDayNight\u4e3b\u9898\uff0c\u6211\u4eec\u4f7f\u7528\u65b9\u6cd5\uff1aAppCompatDelegate.setDefaultNightMode()\u3002\u4ee5\u4e0b\u662f\u4e0a\u8ff0\u65b9\u6cd5\u4e2d\u5141\u8bb8\u7684\u53c2\u6570\u3002<\/p>\n<ul class=\"post-ul\">\n<li>MODE_NIGHT_YES \u2013 \u624b\u52a8\u542f\u7528\u591c\u95f4\u6a21\u5f0f\u3002<\/li>\n<li>MODE_NIGHT_NO \u2013 \u624b\u52a8\u7981\u7528\u591c\u95f4\u6a21\u5f0f\u3002<\/li>\n<li>MODE_NIGHT_FOLLOW_SYSTEM \u2013 \u4f7f\u7528\u7cfb\u7edf\u8bbe\u7f6e\u6765\u786e\u5b9a\u4e00\u5929\u4e2d\u7684\u65f6\u95f4\u5e76\u76f8\u5e94\u5730\u5207\u6362\u591c\u95f4\u6a21\u5f0f\u3002\u8fd9\u662f\u9ed8\u8ba4\u53c2\u6570\u3002<\/li>\n<li>MODE_NIGHT_AUTO \u2013 \u8fd9\u4f1a\u5c1d\u8bd5\u4ece\u8bbe\u5907\u4f4d\u7f6eAPI\u81ea\u52a8\u68c0\u6d4b\u65f6\u95f4\u3002\u5982\u679c\u672a\u6388\u4e88\u4f4d\u7f6e\u670d\u52a1\u7684\u8fd0\u884c\u65f6\u6743\u9650\uff0c\u5219\u4f7f\u7528\u7cfb\u7edf\u65f6\u95f4\u3002<\/li>\n<\/ul>\n<p>\u5728onCreate()\u65b9\u6cd5\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u4ee3\u7801\u3002<\/p>\n<pre class=\"post-pre\"><code>@Override\r\n    protected void onCreate(Bundle savedInstanceState) {\r\n        super.onCreate(savedInstanceState);\r\n        AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); \/\/\u7528\u4e8e\u591c\u95f4\u6a21\u5f0f\u4e3b\u9898\r\n        \/\/AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); \/\/\u7528\u4e8e\u65e5\u95f4\u6a21\u5f0f\u4e3b\u9898\r\n        setContentView(R.layout.activity_main);\r\n    }\r\n<\/code><\/pre>\n<p>\u5728\u8c03\u7528setContentView\u65b9\u6cd5\u4e4b\u524d\uff0c\u5e94\u8be5\u59cb\u7ec8\u8bbe\u7f6e\u4e3b\u9898\u3002<\/p>\n<h3>AppCompatDelegate\u662f\u4ec0\u4e48\uff1f<\/h3>\n<div>\n                            <img decoding=\"async\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/65648026a4b2f92e6c72e2ea\/12-1.png\" class='post-images' alt=\"android\u591c\u95f4\u6a21\u5f0f\" title=\"android\u591c\u95f4\u6a21\u5f0f\"><\/div>\n<pre class=\"post-pre\"><code>&lt;style name=\"AppTheme\" parent=\"Theme.AppCompat.DayNight\"&gt;\r\n        &lt;!-- \u5728\u6b64\u5904\u81ea\u5b9a\u4e49\u60a8\u7684\u4e3b\u9898 --&gt;\r\n        &lt;item name=\"colorPrimary\"&gt;@color\/colorPrimary&lt;\/item&gt;\r\n        &lt;item name=\"colorPrimaryDark\"&gt;@color\/colorPrimaryDark&lt;\/item&gt;\r\n        &lt;item name=\"colorAccent\"&gt;@color\/colorAccent&lt;\/item&gt;\r\n        &lt;item name=\"android:textColorPrimary\"&gt;@android:color\/white&lt;\/item&gt;\r\n        &lt;item name=\"android:textColorSecondary\"&gt;@android:color\/white&lt;\/item&gt;\r\n    &lt;\/style&gt;\r\n<\/code><\/pre>\n<p>\u8981\u83b7\u53d6\u5f53\u524d\u591c\u95f4\u6a21\u5f0f\uff0c\u6211\u4eec\u4f7f\u7528AppCompatDelegate.getDefaultNightMode()\u65b9\u6cd5\uff0c\u8be5\u65b9\u6cd5\u5206\u522b\u8fd4\u56de\u4e4b\u524d\u8ba8\u8bba\u8fc7\u7684\u5404\u79cd\u7c7b\u578b\u7684\u6574\u6570\u503c\u3002\u6709\u4e86\u57fa\u672c\u7684\u6982\u5ff5\u540e\uff0c\u8ba9\u6211\u4eec\u5236\u4f5c\u4e00\u4e2a\u5e94\u7528\u7a0b\u5e8f\uff0c\u5b83\u5c06\uff1a<\/p>\n<ul class=\"post-ul\">\n<li>\u81ea\u5b9a\u4e49\u65e5\u95f4\/\u591c\u95f4\u6a21\u5f0f\u7684\u8d44\u6e90\u548c\u6837\u5f0f\u3002<\/li>\n<li>\u4ece\u7528\u6237\u754c\u9762\u5207\u6362\u65e5\u591c\u4e3b\u9898\u3002<\/li>\n<li>\u67e5\u770b\u5404\u79cdUI\u5c0f\u90e8\u4ef6\u5728\u591c\u95f4\u6a21\u5f0f\u4e0b\u7684\u5916\u89c2\u3002<\/li>\n<\/ul>\n<h3>Android\u591c\u95f4\u6a21\u5f0f\u9879\u76ee\u7ed3\u6784<\/h3>\n<div>\n                            <img decoding=\"async\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/65648026a4b2f92e6c72e2ea\/17-0.png\" class='post-images' alt=\"android\u65e5\u591c\u4e3b\u9898\u793a\u4f8b\u9879\u76ee\" title=\"android\u65e5\u591c\u4e3b\u9898\u793a\u4f8b\u9879\u76ee\"><\/div>\n<h3>Android \u65e5\u591c\u4e3b\u9898\u793a\u4f8b\u4ee3\u7801<\/h3>\n<p>\u4ee5\u4e0b\u662factivity_main.xml\u7c7b\u6587\u4ef6\u7684\u4ee3\u7801\uff1a<\/p>\n<p>\u8fd9\u662f\u6587\u7ae0\u300a\u5728\u5e94\u7528\u4e2d\u4f7f\u7528Android DayNight\u4e3b\u9898\u8fdb\u884c\u591c\u95f4\u6a21\u5f0f\u300b\u7684\u7b2c2\u90e8\u5206\uff08\u51713\u90e8\u5206\uff09\u3002<\/p>\n<pre class=\"post-pre\"><code>&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\r\n&lt;RelativeLayout xmlns:android=\"https:\/\/schemas.android.com\/apk\/res\/android\"\r\n    android:layout_width=\"match_parent\"\r\n    android:layout_height=\"match_parent\"&gt;\r\n\r\n\r\n    &lt;TextView\r\n        android:layout_width=\"wrap_content\"\r\n        android:layout_height=\"wrap_content\"\r\n        android:layout_alignParentTop=\"true\"\r\n        android:layout_centerHorizontal=\"true\"\r\n        android:layout_margin=\"@android:dimen\/app_icon_size\"\r\n        android:text=\"\u6b22\u8fce\u4f7f\u7528\u672c\u6559\u7a0b\"\r\n        android:textColor=\"@color\/daynight_textColor\"\r\n        android:textSize=\"18sp\" \/&gt;\r\n\r\n    &lt;ImageView\r\n        android:id=\"@+id\/imageView\"\r\n        android:layout_width=\"250dp\"\r\n        android:layout_height=\"250dp\"\r\n        android:layout_centerInParent=\"true\"\r\n        android:src=\"@drawable\/placeholder\" \/&gt;\r\n\r\n\r\n    &lt;TextView\r\n        android:id=\"@+id\/txtNightMode\"\r\n        android:layout_width=\"wrap_content\"\r\n        android:layout_height=\"wrap_content\"\r\n        android:layout_alignBaseline=\"@+id\/switchCompat\"\r\n        android:layout_centerHorizontal=\"true\"\r\n        android:paddingRight=\"8dp\"\r\n        android:text=\"\u591c\u95f4\u6a21\u5f0f\"\r\n        android:textColor=\"@color\/daynight_textColor\" \/&gt;\r\n\r\n\r\n    &lt;android.support.v7.widget.SwitchCompat\r\n        android:id=\"@+id\/switchCompat\"\r\n        android:layout_width=\"wrap_content\"\r\n        android:layout_height=\"wrap_content\"\r\n        android:layout_alignParentBottom=\"true\"\r\n        android:layout_marginBottom=\"@android:dimen\/app_icon_size\"\r\n        android:layout_toRightOf=\"@+id\/txtNightMode\"\r\n        android:checked=\"false\"\r\n        android:textAppearance=\"?android:attr\/textAppearanceMedium\" \/&gt;\r\n\r\n    &lt;Button\r\n        android:id=\"@+id\/button\"\r\n        android:layout_width=\"wrap_content\"\r\n        android:layout_height=\"wrap_content\"\r\n        android:layout_above=\"@+id\/imageView\"\r\n        android:layout_alignLeft=\"@+id\/txtNightMode\"\r\n        android:layout_alignStart=\"@+id\/txtNightMode\"\r\n        android:text=\"\u70b9\u51fb\u6211\"\r\n        android:textColor=\"@color\/daynight_textColor\" \/&gt;\r\n&lt;\/RelativeLayout&gt;\r\n<\/code><\/pre>\n<ul class=\"post-ul\">\n<li>\u6211\u4eec\u5728ImageView\u4e0a\u8bbe\u7f6e\u4e86\u81ea\u5b9a\u4e49\u6587\u672c\u989c\u8272\u548c\u53ef\u7ed8\u5236\u8d44\u6e90\u3002<\/li>\n<li>\u4e3a\u4e86\u4e3a\u65e5\u95f4\u548c\u591c\u95f4\u4e3b\u9898\u8bbe\u7f6e\u4e0d\u540c\u7684\u989c\u8272\u548c\u53ef\u7ed8\u5236\u8d44\u6e90\uff0c\u6211\u4eec\u9700\u8981\u4e3a\u8fd9\u4e9b\u8d44\u6e90\u521b\u5efa\u5355\u72ec\u7684\u6587\u4ef6\u5939\u3002<\/li>\n<li>\u65e5\u95f4\u4e3b\u9898\u8d44\u6e90\u4f4d\u4e8e\u9ed8\u8ba4\u76ee\u5f55\u4e2d\u3002<\/li>\n<li>\u591c\u95f4\u4e3b\u9898\u8d44\u6e90\u4f4d\u4e8e\u540d\u79f0\u540e\u7f00\u4e3a-night\u7684\u6587\u4ef6\u5939\u4e2d\u3002<\/li>\n<li>\u56e0\u6b64\uff0c\u6211\u4eec\u5728\u9879\u76ee\u4e2d\u521b\u5efa\u4e86values-night\u548cdrawable-night\u6587\u4ef6\u5939\u3002<\/li>\n<li>\u5bf9\u4e8e\u5e0c\u671b\u5728DayNight\u4e3b\u9898\u4e2d\u5207\u6362\u7684\u8d44\u6e90\uff0c\u53ef\u7ed8\u5236\u6587\u4ef6\u540d\u3001\u989c\u8272\u3001\u6837\u5f0f\u540d\u79f0\u5728\u4e24\u4e2a\u76ee\u5f55\u4e2d\u5fc5\u987b\u76f8\u540c\u3002<\/li>\n<li>\u5982\u679c\u4e0a\u8ff0\u5185\u5bb9\u4ec5\u5728\u4e00\u4e2a\u76ee\u5f55\u4e2d\u5b9a\u4e49\uff0c\u5219\u65e5\u95f4\u548c\u591c\u95f4\u4e3b\u9898\u5c06\u4f7f\u7528\u76f8\u540c\u7684\u8d44\u6e90\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0b\u662fvalues\u548cvalues-night\u6587\u4ef6\u5939\u4e2dstyles.xml\u4e2d\u7684\u4ee3\u7801\u3002<\/p>\n<pre class=\"post-pre\"><code>&lt;resources&gt;\r\n\r\n    &lt;!-- \u57fa\u7840\u5e94\u7528\u4e3b\u9898\u3002 --&gt;\r\n    &lt;style name=\"AppTheme\" parent=\"Theme.AppCompat.DayNight\"&gt;\r\n        &lt;!-- \u5728\u6b64\u5904\u81ea\u5b9a\u4e49\u60a8\u7684\u4e3b\u9898\u3002 --&gt;\r\n        &lt;item name=\"colorPrimary\"&gt;@color\/colorPrimary&lt;\/item&gt;\r\n        &lt;item name=\"colorPrimaryDark\"&gt;@color\/colorPrimaryDark&lt;\/item&gt;\r\n        &lt;item name=\"colorAccent\"&gt;@color\/colorAccent&lt;\/item&gt;\r\n        &lt;item name=\"android:textColorPrimary\"&gt;@android:color\/white&lt;\/item&gt;\r\n    &lt;\/style&gt;\r\n\r\n    &lt;style name=\"MyDialog\" parent=\"Theme.AppCompat.Light.Dialog.Alert\"\/&gt;\r\n\r\n    &lt;style name=\"MySwitch\"&gt;\r\n        &lt;item name=\"colorControlActivated\"&gt;@color\/switchColor&lt;\/item&gt;\r\n    &lt;\/style&gt;\r\n&lt;\/resources&gt;\r\n<\/code><\/pre>\n<pre class=\"post-pre\"><code>&lt;resources&gt;\r\n    &lt;!-- \u57fa\u7840\u5e94\u7528\u4e3b\u9898\u3002values-night.xml --&gt;\r\n    &lt;style name=\"AppTheme\" parent=\"Theme.AppCompat.DayNight\"&gt;\r\n        &lt;!-- \u5728\u6b64\u5904\u81ea\u5b9a\u4e49\u60a8\u7684\u4e3b\u9898\u3002 --&gt;\r\n        &lt;item name=\"colorPrimary\"&gt;@color\/orange&lt;\/item&gt;\r\n        &lt;item name=\"colorPrimaryDark\"&gt;@color\/orangeDark&lt;\/item&gt;\r\n        &lt;item name=\"colorAccent\"&gt;@color\/colorAccent&lt;\/item&gt;\r\n        &lt;item name=\"android:textColorPrimary\"&gt;@android:color\/white&lt;\/item&gt;\r\n    &lt;\/style&gt;\r\n\r\n    &lt;style name=\"MyDialog\" parent=\"Theme.AppCompat.DayNight.Dialog.Alert\"\/&gt;\r\n\r\n    &lt;style name=\"MySwitch\"&gt;\r\n        &lt;item name=\"colorControlActivated\"&gt;@color\/switchColor&lt;\/item&gt;\r\n    &lt;\/style&gt;\r\n&lt;\/resources&gt;\r\n<\/code><\/pre>\n<div>\n    <img decoding=\"async\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/65648026a4b2f92e6c72e2ea\/25-1.png\" class='post-images' alt=\"android daynight \u65e5\u95f4\u6a21\u5f0f\u989c\u8272\" title=\"\">\n<\/div>\n<p>\u5728\u4e0a\u9762\u7684\u4ee3\u7801\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528Switch\u7ec4\u4ef6\u5728\u5e94\u7528\u7a0b\u5e8f\u4e2d\u5207\u6362\u767d\u5929\u548c\u591c\u95f4\u6a21\u5f0f\u4e3b\u9898\u3002\u6211\u4eec\u5c06\u5f53\u524d\u6a21\u5f0f\u4fdd\u5b58\u5728SharedPreferences\u5bf9\u8c61\u4e2d\u3002\u4e3a\u4ec0\u4e48\u5462\uff1f\u56e0\u4e3a\u4e00\u4e2a\u6d3b\u52a8\u7684\u4e3b\u9898\u53ea\u80fd\u8bbe\u7f6e\u4e00\u6b21\u3002\u56e0\u6b64\uff0c\u5f53\u5207\u6362\u5f00\u5173\u65f6\uff0c\u6211\u4eec\u9700\u8981\u5c06\u65b0\u7684\u6a21\u5f0f\u4fdd\u5b58\u5728SharedPreferences\u5bf9\u8c61\u4e2d\u3002\u6211\u4eec\u4f7f\u7528\u5355\u4f8b\u6a21\u5f0f\u6765\u521b\u5efaApplication\u7c7b\u3002\u8fd9\u6837\uff0c\u76f8\u540c\u7684Application\u7c7b\u5b9e\u4f8b\u53ef\u4ee5\u5728\u6574\u4e2a\u5e94\u7528\u7a0b\u5e8f\u4e2d\u4f7f\u7528\u3002InitApplication.java\u7c7b\u7684\u4ee3\u7801\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<pre class=\"post-pre\"><code>package com.Olivia.daynightmode;\r\n\r\nimport android.content.Intent;\r\nimport android.support.v7.app.AlertDialog;\r\nimport android.support.v7.app.AppCompatActivity;\r\nimport android.os.Bundle;\r\nimport android.support.v7.app.AppCompatDelegate;\r\nimport android.support.v7.widget.SwitchCompat;\r\nimport android.view.View;\r\nimport android.widget.Button;\r\nimport android.widget.CompoundButton;\r\n\r\npublic class MainActivity extends AppCompatActivity {\r\n\r\n    @Override\r\n    protected void onCreate(Bundle savedInstanceState) {\r\n        super.onCreate(savedInstanceState);\r\n        if (InitApplication.getInstance().isNightModeEnabled()) {\r\n            AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);\r\n        } else {\r\n            AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);\r\n        }\r\n        setContentView(R.layout.activity_main);\r\n\r\n\r\n        SwitchCompat switchCompat = findViewById(R.id.switchCompat);\r\n        Button button = findViewById(R.id.button);\r\n        button.setOnClickListener(new View.OnClickListener() {\r\n            @Override\r\n            public void onClick(View v) {\r\n                new AlertDialog.Builder(MainActivity.this, R.style.MyDialog)\r\n                        .setTitle(\"\u6807\u9898\")\r\n                        .setMessage(\"\u6d88\u606f\")\r\n                        .show();\r\n            }\r\n        });\r\n\r\n        if (AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_YES)\r\n            switchCompat.setChecked(true);\r\n\r\n        switchCompat.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {\r\n            @Override\r\n            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {\r\n                if (isChecked) {\r\n                    InitApplication.getInstance().setIsNightModeEnabled(true);\r\n                    Intent intent = getIntent();\r\n                    intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);\r\n                    finish();\r\n                    startActivity(intent);\r\n\r\n                } else {\r\n                    InitApplication.getInstance().setIsNightModeEnabled(false);\r\n                    Intent intent = getIntent();\r\n                    intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);\r\n                    finish();\r\n                    startActivity(intent);\r\n                }\r\n\r\n\r\n            }\r\n        });\r\n\r\n    }\r\n}\r\n<\/code><\/pre>\n<p>\u6211\u4eec\u5728\u8fd9\u91cc\u4eceShared Preferences\u4e2d\u66f4\u65b0\u548c\u68c0\u7d22\u591c\u95f4\u6a21\u5f0f\u7c7b\u578b\u3002<\/p>\n<pre class=\"post-pre\"><code>package com.Olivia.daynightmode;\r\n\r\nimport android.app.Application;\r\nimport android.content.SharedPreferences;\r\nimport android.preference.PreferenceManager;\r\n\r\n\r\npublic class InitApplication extends Application {\r\n    public static final String NIGHT_MODE = \"NIGHT_MODE\";\r\n    private boolean isNightModeEnabled = false;\r\n\r\n    private static InitApplication singleton = null;\r\n\r\n    public static InitApplication getInstance() {\r\n\r\n        if(singleton == null)\r\n        {\r\n            singleton = new InitApplication();\r\n        }\r\n        return singleton;\r\n    }\r\n\r\n    @Override\r\n    public void onCreate() {\r\n        super.onCreate();\r\n        singleton = this;\r\n        SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(this);\r\n        this.isNightModeEnabled = mPrefs.getBoolean(NIGHT_MODE, false);\r\n    }\r\n\r\n    public boolean isNightModeEnabled() {\r\n        return isNightModeEnabled;\r\n    }\r\n\r\n    public void setIsNightModeEnabled(boolean isNightModeEnabled) {\r\n        this.isNightModeEnabled = isNightModeEnabled;\r\n\r\n        SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(this);\r\n        SharedPreferences.Editor editor = mPrefs.edit();\r\n        editor.putBoolean(NIGHT_MODE, isNightModeEnabled);\r\n        editor.apply();\r\n    }\r\n}\r\n<\/code><\/pre>\n<h3>\u5b89\u5353\u591c\u95f4\u6a21\u5f0f\u652f\u6301\u5e94\u7528\u7a0b\u5e8f\u7684\u8f93\u51fa\u6548\u679c<\/h3>\n<div>\n                            <img decoding=\"async\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/65648026a4b2f92e6c72e2ea\/31-0.gif\" class=\"post-images\" alt=\"android daynight theme output\" title=\"\" \/>\n                        <\/div>\n<p>\u4e0b\u8f7dAndroid\u65e5\u591c\u4e3b\u9898\u793a\u4f8b\u9879\u76ee\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u672c\u6559\u7a0b\u4e2d\uff0c\u6211\u4eec\u5c06\u8ba8\u8bba\u5982\u4f55\u5728\u6211\u4eec\u7684\u5e94\u7528\u7a0b\u5e8f\u4e2d\u4f7f\u7528Android\u7684\u65e5\u591c\u4e3b\u9898\u3002\u5982\u679c\u60a8\u7684\u5e94\u7528\u7a0b\u5e8f\u5305\u542b\u9605\u8bfb\u6750\u6599\uff0c\u90a3\u4e48\u5177 [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[900,1094,1029,902,1093],"class_list":["post-316","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-android","tag-daynight","tag-material-design","tag-ui","tag-1093"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Android DayNight\u4e3b\u9898\u5b9e\u73b0\u5e94\u7528\u591c\u95f4\u6a21\u5f0f\u6559\u7a0b - Blog - Silicon Cloud<\/title>\n<meta name=\"description\" content=\"\u672c\u6587\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u5728Android\u5e94\u7528\u4e2d\u4f7f\u7528DayNight\u4e3b\u9898\u5b9e\u73b0\u591c\u95f4\u6a21\u5f0f\u529f\u80fd\u3002\u901a\u8fc7Material Design\u7684DayNight\u4e3b\u9898\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u8f7b\u677e\u4e3a\u5e94\u7528\u6dfb\u52a0\u81ea\u52a8\u5207\u6362\u65e5\u95f4\/\u591c\u95f4\u6a21\u5f0f\u7684\u529f\u80fd\uff0c\u63d0\u5347\u7528\u6237\u4f53\u9a8c\u3002\u6587\u7ae0\u5305\u542b\u5b8c\u6574\u4ee3\u7801\u793a\u4f8b\u548c\u5b9e\u73b0\u6b65\u9aa4\uff0c\u9002\u5408Android\u5f00\u53d1\u8005\u5b66\u4e60\u53c2\u8003\u3002\" \/>\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.silicloud.com\/zh\/blog\/\u5728\u5e94\u7528\u4e2d\u4f7f\u7528android-daynight\u4e3b\u9898\u8fdb\u884c\u591c\u95f4\u6a21\u5f0f\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Android DayNight\u4e3b\u9898\u5b9e\u73b0\u5e94\u7528\u591c\u95f4\u6a21\u5f0f\u6559\u7a0b\" \/>\n<meta property=\"og:description\" content=\"\u672c\u6587\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u5728Android\u5e94\u7528\u4e2d\u4f7f\u7528DayNight\u4e3b\u9898\u5b9e\u73b0\u591c\u95f4\u6a21\u5f0f\u529f\u80fd\u3002\u901a\u8fc7Material Design\u7684DayNight\u4e3b\u9898\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u8f7b\u677e\u4e3a\u5e94\u7528\u6dfb\u52a0\u81ea\u52a8\u5207\u6362\u65e5\u95f4\/\u591c\u95f4\u6a21\u5f0f\u7684\u529f\u80fd\uff0c\u63d0\u5347\u7528\u6237\u4f53\u9a8c\u3002\u6587\u7ae0\u5305\u542b\u5b8c\u6574\u4ee3\u7801\u793a\u4f8b\u548c\u5b9e\u73b0\u6b65\u9aa4\uff0c\u9002\u5408Android\u5f00\u53d1\u8005\u5b66\u4e60\u53c2\u8003\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/\u5728\u5e94\u7528\u4e2d\u4f7f\u7528android-daynight\u4e3b\u9898\u8fdb\u884c\u591c\u95f4\u6a21\u5f0f\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-06-19T15:39:52+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-08-01T13:33:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/65648026a4b2f92e6c72e2ea\/12-1.png\" \/>\n<meta name=\"author\" content=\"\u97f5, \u79d1\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u97f5, \u79d1\" \/>\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.silicloud.com\/zh\/blog\/%e5%9c%a8%e5%ba%94%e7%94%a8%e4%b8%ad%e4%bd%bf%e7%94%a8android-daynight%e4%b8%bb%e9%a2%98%e8%bf%9b%e8%a1%8c%e5%a4%9c%e9%97%b4%e6%a8%a1%e5%bc%8f\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8%e5%ba%94%e7%94%a8%e4%b8%ad%e4%bd%bf%e7%94%a8android-daynight%e4%b8%bb%e9%a2%98%e8%bf%9b%e8%a1%8c%e5%a4%9c%e9%97%b4%e6%a8%a1%e5%bc%8f\/\",\"name\":\"Android DayNight\u4e3b\u9898\u5b9e\u73b0\u5e94\u7528\u591c\u95f4\u6a21\u5f0f\u6559\u7a0b - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2023-06-19T15:39:52+00:00\",\"dateModified\":\"2025-08-01T13:33:05+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/6530331a63adef3b3443a1fab53a0e6e\"},\"description\":\"\u672c\u6587\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u5728Android\u5e94\u7528\u4e2d\u4f7f\u7528DayNight\u4e3b\u9898\u5b9e\u73b0\u591c\u95f4\u6a21\u5f0f\u529f\u80fd\u3002\u901a\u8fc7Material Design\u7684DayNight\u4e3b\u9898\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u8f7b\u677e\u4e3a\u5e94\u7528\u6dfb\u52a0\u81ea\u52a8\u5207\u6362\u65e5\u95f4\/\u591c\u95f4\u6a21\u5f0f\u7684\u529f\u80fd\uff0c\u63d0\u5347\u7528\u6237\u4f53\u9a8c\u3002\u6587\u7ae0\u5305\u542b\u5b8c\u6574\u4ee3\u7801\u793a\u4f8b\u548c\u5b9e\u73b0\u6b65\u9aa4\uff0c\u9002\u5408Android\u5f00\u53d1\u8005\u5b66\u4e60\u53c2\u8003\u3002\",\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8%e5%ba%94%e7%94%a8%e4%b8%ad%e4%bd%bf%e7%94%a8android-daynight%e4%b8%bb%e9%a2%98%e8%bf%9b%e8%a1%8c%e5%a4%9c%e9%97%b4%e6%a8%a1%e5%bc%8f\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8%e5%ba%94%e7%94%a8%e4%b8%ad%e4%bd%bf%e7%94%a8android-daynight%e4%b8%bb%e9%a2%98%e8%bf%9b%e8%a1%8c%e5%a4%9c%e9%97%b4%e6%a8%a1%e5%bc%8f\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8%e5%ba%94%e7%94%a8%e4%b8%ad%e4%bd%bf%e7%94%a8android-daynight%e4%b8%bb%e9%a2%98%e8%bf%9b%e8%a1%8c%e5%a4%9c%e9%97%b4%e6%a8%a1%e5%bc%8f\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Android DayNight\u4e3b\u9898\u5b9e\u73b0\u5e94\u7528\u591c\u95f4\u6a21\u5f0f\u6559\u7a0b\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/6530331a63adef3b3443a1fab53a0e6e\",\"name\":\"\u97f5, \u79d1\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/429ccb39b3fff5188bc17986222cfb0936cbadb8cc933cff04ab5ca01bd30a08?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/429ccb39b3fff5188bc17986222cfb0936cbadb8cc933cff04ab5ca01bd30a08?s=96&d=mm&r=g\",\"caption\":\"\u97f5, \u79d1\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/yunke\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8%e5%ba%94%e7%94%a8%e4%b8%ad%e4%bd%bf%e7%94%a8android-daynight%e4%b8%bb%e9%a2%98%e8%bf%9b%e8%a1%8c%e5%a4%9c%e9%97%b4%e6%a8%a1%e5%bc%8f\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Android DayNight\u4e3b\u9898\u5b9e\u73b0\u5e94\u7528\u591c\u95f4\u6a21\u5f0f\u6559\u7a0b - Blog - Silicon Cloud","description":"\u672c\u6587\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u5728Android\u5e94\u7528\u4e2d\u4f7f\u7528DayNight\u4e3b\u9898\u5b9e\u73b0\u591c\u95f4\u6a21\u5f0f\u529f\u80fd\u3002\u901a\u8fc7Material Design\u7684DayNight\u4e3b\u9898\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u8f7b\u677e\u4e3a\u5e94\u7528\u6dfb\u52a0\u81ea\u52a8\u5207\u6362\u65e5\u95f4\/\u591c\u95f4\u6a21\u5f0f\u7684\u529f\u80fd\uff0c\u63d0\u5347\u7528\u6237\u4f53\u9a8c\u3002\u6587\u7ae0\u5305\u542b\u5b8c\u6574\u4ee3\u7801\u793a\u4f8b\u548c\u5b9e\u73b0\u6b65\u9aa4\uff0c\u9002\u5408Android\u5f00\u53d1\u8005\u5b66\u4e60\u53c2\u8003\u3002","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.silicloud.com\/zh\/blog\/\u5728\u5e94\u7528\u4e2d\u4f7f\u7528android-daynight\u4e3b\u9898\u8fdb\u884c\u591c\u95f4\u6a21\u5f0f\/","og_locale":"zh_CN","og_type":"article","og_title":"Android DayNight\u4e3b\u9898\u5b9e\u73b0\u5e94\u7528\u591c\u95f4\u6a21\u5f0f\u6559\u7a0b","og_description":"\u672c\u6587\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u5728Android\u5e94\u7528\u4e2d\u4f7f\u7528DayNight\u4e3b\u9898\u5b9e\u73b0\u591c\u95f4\u6a21\u5f0f\u529f\u80fd\u3002\u901a\u8fc7Material Design\u7684DayNight\u4e3b\u9898\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u8f7b\u677e\u4e3a\u5e94\u7528\u6dfb\u52a0\u81ea\u52a8\u5207\u6362\u65e5\u95f4\/\u591c\u95f4\u6a21\u5f0f\u7684\u529f\u80fd\uff0c\u63d0\u5347\u7528\u6237\u4f53\u9a8c\u3002\u6587\u7ae0\u5305\u542b\u5b8c\u6574\u4ee3\u7801\u793a\u4f8b\u548c\u5b9e\u73b0\u6b65\u9aa4\uff0c\u9002\u5408Android\u5f00\u53d1\u8005\u5b66\u4e60\u53c2\u8003\u3002","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/\u5728\u5e94\u7528\u4e2d\u4f7f\u7528android-daynight\u4e3b\u9898\u8fdb\u884c\u591c\u95f4\u6a21\u5f0f\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-06-19T15:39:52+00:00","article_modified_time":"2025-08-01T13:33:05+00:00","og_image":[{"url":"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/65648026a4b2f92e6c72e2ea\/12-1.png"}],"author":"\u97f5, \u79d1","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u97f5, \u79d1","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8%e5%ba%94%e7%94%a8%e4%b8%ad%e4%bd%bf%e7%94%a8android-daynight%e4%b8%bb%e9%a2%98%e8%bf%9b%e8%a1%8c%e5%a4%9c%e9%97%b4%e6%a8%a1%e5%bc%8f\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8%e5%ba%94%e7%94%a8%e4%b8%ad%e4%bd%bf%e7%94%a8android-daynight%e4%b8%bb%e9%a2%98%e8%bf%9b%e8%a1%8c%e5%a4%9c%e9%97%b4%e6%a8%a1%e5%bc%8f\/","name":"Android DayNight\u4e3b\u9898\u5b9e\u73b0\u5e94\u7528\u591c\u95f4\u6a21\u5f0f\u6559\u7a0b - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2023-06-19T15:39:52+00:00","dateModified":"2025-08-01T13:33:05+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/6530331a63adef3b3443a1fab53a0e6e"},"description":"\u672c\u6587\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u5728Android\u5e94\u7528\u4e2d\u4f7f\u7528DayNight\u4e3b\u9898\u5b9e\u73b0\u591c\u95f4\u6a21\u5f0f\u529f\u80fd\u3002\u901a\u8fc7Material Design\u7684DayNight\u4e3b\u9898\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u8f7b\u677e\u4e3a\u5e94\u7528\u6dfb\u52a0\u81ea\u52a8\u5207\u6362\u65e5\u95f4\/\u591c\u95f4\u6a21\u5f0f\u7684\u529f\u80fd\uff0c\u63d0\u5347\u7528\u6237\u4f53\u9a8c\u3002\u6587\u7ae0\u5305\u542b\u5b8c\u6574\u4ee3\u7801\u793a\u4f8b\u548c\u5b9e\u73b0\u6b65\u9aa4\uff0c\u9002\u5408Android\u5f00\u53d1\u8005\u5b66\u4e60\u53c2\u8003\u3002","breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8%e5%ba%94%e7%94%a8%e4%b8%ad%e4%bd%bf%e7%94%a8android-daynight%e4%b8%bb%e9%a2%98%e8%bf%9b%e8%a1%8c%e5%a4%9c%e9%97%b4%e6%a8%a1%e5%bc%8f\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8%e5%ba%94%e7%94%a8%e4%b8%ad%e4%bd%bf%e7%94%a8android-daynight%e4%b8%bb%e9%a2%98%e8%bf%9b%e8%a1%8c%e5%a4%9c%e9%97%b4%e6%a8%a1%e5%bc%8f\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8%e5%ba%94%e7%94%a8%e4%b8%ad%e4%bd%bf%e7%94%a8android-daynight%e4%b8%bb%e9%a2%98%e8%bf%9b%e8%a1%8c%e5%a4%9c%e9%97%b4%e6%a8%a1%e5%bc%8f\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"Android DayNight\u4e3b\u9898\u5b9e\u73b0\u5e94\u7528\u591c\u95f4\u6a21\u5f0f\u6559\u7a0b"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/6530331a63adef3b3443a1fab53a0e6e","name":"\u97f5, \u79d1","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/429ccb39b3fff5188bc17986222cfb0936cbadb8cc933cff04ab5ca01bd30a08?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/429ccb39b3fff5188bc17986222cfb0936cbadb8cc933cff04ab5ca01bd30a08?s=96&d=mm&r=g","caption":"\u97f5, \u79d1"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/yunke\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8%e5%ba%94%e7%94%a8%e4%b8%ad%e4%bd%bf%e7%94%a8android-daynight%e4%b8%bb%e9%a2%98%e8%bf%9b%e8%a1%8c%e5%a4%9c%e9%97%b4%e6%a8%a1%e5%bc%8f\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/316","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=316"}],"version-history":[{"count":3,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/316\/revisions"}],"predecessor-version":[{"id":109814,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/316\/revisions\/109814"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=316"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=316"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=316"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}