java.lang.IllegalStateException: Only fullscreen opaque activities can request orientation

前端 未结 30 1745
难免孤独
难免孤独 2020-12-02 04:43

I am facing the problem while retrieving the contacts from the contact book in Android 8.0 Oreo java.lang.IllegalStateException: Only fullscreen opaque activities can reques

30条回答
  •  感情败类
    2020-12-02 05:45

    Google throws this exception on Activity's onCreate method after v27, their meaning is : if an Activity is translucent or floating, its orientation should be relied on parent(background) Activity, can't make decision on itself.

    Even if you remove android:screenOrientation="portrait" from the floating or translucent Activity but fix orientation on its parent(background) Activity, it is still fixed by the parent, I have tested already.

    One special situation : if you make translucent on a launcher Activity, it has't parent(background), so always rotate with device. Want to fix it, you have to take another way to replace true style.

提交回复
热议问题