{"id":1254,"date":"2023-03-18T09:45:39","date_gmt":"2023-03-18T01:45:39","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=1254"},"modified":"2023-04-29T09:28:56","modified_gmt":"2023-04-29T01:28:56","slug":"android-8-record-only-fullscreen-opaque-activities-can-request-orientation","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/03\/18\/android-8-record-only-fullscreen-opaque-activities-can-request-orientation\/","title":{"rendered":"Android 8.0\u8e29\u5751\u8bb0\u5f55\u4e4bOnly fullscreen opaque activities can request orientation"},"content":{"rendered":"<h2>\u95ee\u9898\u63cf\u8ff0<\/h2>\n<p>Android 8.0\u4e0b\u5d29\u6e83\u9519\u8bef\uff1a<code>Only fullscreen opaque activities can request orientation<\/code>\uff0c\u5373\u53ea\u6709\u5168\u5c4f\u4e0d\u900f\u660e\u7684Activity\u624d\u53ef\u4ee5\u8bbe\u7f6e\u65b9\u5411<\/p>\n<p><!-- more --><\/p>\n<pre><code>java.lang.RuntimeException: Unable to start activity ComponentInfo{cn.appblog.example\/cn.appblog.lib.google.signin.GoogleSignInActivity}: \n    java.lang.IllegalStateException: Only fullscreen opaque activities can request orientation<\/code><\/pre>\n<p>\u539f\u56e0\uff1a\u51fa\u73b0\u8fd9\u6837\u7684\u95ee\u9898\uff0c\u7edd\u5927\u591a\u6570\u90fd\u662f\u56e0\u4e3a\u6211\u4eec\u4e3a\u4e86\u63d0\u9ad8\u7528\u6237\u4f53\u9a8c\uff0c\u6216\u8005\u56e0\u4e3a\u80cc\u666f\u8bbe\u7f6e\u9700\u8981\uff0c\u624b\u52a8\u53d6\u6d88App\u542f\u52a8\u767d\u5c4f\u6216\u8005\u9ed1\u5c4f\u7684\u65f6\u5019\uff0c\u5c06Splash\u754c\u9762\u8bbe\u4e3a\u4e86\u900f\u660e\uff0c\u7136\u540e\u8fd9\u4e2a\u65f6\u5019\u53c8\u8bbe\u7f6e\u4e86\u65b9\u5411\u4e3a\u5782\u76f4\uff0c\u4ece\u800c\u5bfc\u81f4\u4e86\u8fd9\u4e2a\u95ee\u9898\u3002<\/p>\n<p>\u89e3\u51b3\u65b9\u6848<\/p>\n<h2>\u53d6\u6d88screenOrientation<\/h2>\n<pre><code class=\"language-xml\">android:screenOrientation=&quot;portrait&quot;<\/code><\/pre>\n<h2>\u4fee\u6539style<\/h2>\n<p>\u627e\u5230\u8bbe\u7f6e\u900f\u660e\u7684Activity\uff0c\u7136\u540e\u5728\u5176Theme\u4e2d\u5c06<code>android:windowIsTranslucent<\/code>\u6539\u4e3afalse\uff0c\u5e76\u6dfb\u52a0<code>android:windowDisablePreview<\/code>\u4e3atrue<\/p>\n<pre><code class=\"language-xml\">&lt;item name=&quot;android:windowIsTranslucent&quot;&gt;false&lt;\/item&gt;\n&lt;item name=&quot;android:windowDisablePreview&quot;&gt;true&lt;\/item&gt;<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u95ee\u9898\u63cf\u8ff0 Android 8.0\u4e0b\u5d29\u6e83\u9519\u8bef\uff1aOnly fullscreen opaque activities [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[61],"tags":[],"class_list":["post-1254","post","type-post","status-publish","format-standard","hentry","category-android-basic"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1254","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1254"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1254\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1254"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1254"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1254"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}