我想在锁定屏幕时保持屏幕方向和应用程序。
但是当我在应用程序运行时锁定屏幕后解锁屏幕时, 然后设备只显示黑屏。它通过触摸使用react(通过日志检查)但没有显示任何内容。 我正在使用全屏大小的 TextureView。
我使用Samsung Galaxy Note 4开发,android版本是4.4.4。
- 启动应用程序(由我开发)。
- 锁定屏幕。
- 解锁屏幕。
- 出现黑屏。 <== 我的问题
有关启动应用程序、屏幕锁定、屏幕解锁的有关 WindowManager 的日志如下。
11-14 18:55:26.132: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, mbResultFaceDectection: false
11-14 18:55:26.132: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, Rotation: -1
11-14 18:55:26.132: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, mbResultFaceDectection: false
11-14 18:55:26.132: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, Rotation: -1
11-14 18:55:26.132: V/WindowManager(3409): rotationForOrientationLw(orient=0, last=0); user=0 USER_ROTATION_LOCKED sensorRotation=-1 mLidState=-1 mDockMode=0 mHdmiPlugged=false mAccelerometerDefault=false gripRotationLock=false
11-14 18:55:26.142: D/SamsungWindowManager(3409): setRotationLw() : rotation=1
11-14 18:55:26.187: D/WindowManager(3409): performLayoutAndPlaceSurfacesLocked called before config changed.
11-14 18:55:26.217: D/CenterBarWindow(21578): onConfigurationChanged point = Point(1280, 720)
11-14 18:55:26.217: D/WindowManager(3409): performLayoutAndPlaceSurfacesLocked called before config changed.
11-14 18:55:26.477: I/WindowManager(3409): Screen frozen for +337ms due to Window{452f1008 u0 Starting net.herit.iotwm.smartphone}
11-14 18:55:27.062: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, mbResultFaceDectection: false
11-14 18:55:27.062: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, Rotation: -1
11-14 18:55:27.062: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, mbResultFaceDectection: false
11-14 18:55:27.062: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, Rotation: -1
11-14 18:55:27.062: V/WindowManager(3409): rotationForOrientationLw(orient=0, last=1); user=0 USER_ROTATION_LOCKED sensorRotation=-1 mLidState=-1 mDockMode=0 mHdmiPlugged=false mAccelerometerDefault=false gripRotationLock=false
11-14 18:55:30.532: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, mbResultFaceDectection: false
11-14 18:55:30.532: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, Rotation: -1
11-14 18:55:30.532: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, mbResultFaceDectection: false
11-14 18:55:30.532: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, Rotation: -1
11-14 18:55:30.532: V/WindowManager(3409): rotationForOrientationLw(orient=1, last=1); user=0 USER_ROTATION_LOCKED sensorRotation=-1 mLidState=-1 mDockMode=0 mHdmiPlugged=false mAccelerometerDefault=false gripRotationLock=false
11-14 18:55:30.547: D/SamsungWindowManager(3409): setRotationLw() : rotation=0
11-14 18:55:30.567: D/WindowManager(3409): performLayoutAndPlaceSurfacesLocked called before config changed.
11-14 18:55:30.587: D/WindowManager(3409): performLayoutAndPlaceSurfacesLocked called before config changed.
11-14 18:55:30.597: D/CenterBarWindow(21578): onConfigurationChanged point = Point(720, 1280)
11-14 18:55:30.807: I/WindowManager(3409): Screen frozen for +257ms due to Window{43593a68 u0 Keyguard}
11-14 18:55:31.287: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, mbResultFaceDectection: false
11-14 18:55:31.287: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, Rotation: -1
11-14 18:55:31.287: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, mbResultFaceDectection: false
11-14 18:55:31.287: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, Rotation: -1
11-14 18:55:31.287: V/WindowManager(3409): rotationForOrientationLw(orient=1, last=0); user=0 USER_ROTATION_LOCKED sensorRotation=-1 mLidState=-1 mDockMode=0 mHdmiPlugged=false mAccelerometerDefault=false gripRotationLock=false
11-14 18:55:32.472: E/SamsungWindowManager(3409): mCoreNumLockHelper.acquire
11-14 18:55:32.517: I/WindowManager(3409): Lock screen displayed!
11-14 18:55:34.717: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, mbResultFaceDectection: false
11-14 18:55:34.717: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, Rotation: -1
11-14 18:55:34.717: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, mbResultFaceDectection: false
11-14 18:55:34.717: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, Rotation: -1
11-14 18:55:34.717: V/WindowManager(3409): rotationForOrientationLw(orient=0, last=0); user=0 USER_ROTATION_LOCKED sensorRotation=-1 mLidState=-1 mDockMode=0 mHdmiPlugged=false mAccelerometerDefault=false gripRotationLock=false
11-14 18:55:34.727: D/SamsungWindowManager(3409): setRotationLw() : rotation=1
11-14 18:55:34.747: D/WindowManager(3409): performLayoutAndPlaceSurfacesLocked called before config changed.
11-14 18:55:34.757: D/WindowManager(3409): performLayoutAndPlaceSurfacesLocked called before config changed.
11-14 18:55:34.797: D/CenterBarWindow(21578): onConfigurationChanged point = Point(1280, 720)
11-14 18:55:34.902: I/WindowManager(3409): Screen frozen for +169ms due to Window{446612a8 u0 MultiWindowTrayService/AppListWindow 0}
11-14 18:55:35.337: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, mbResultFaceDectection: false
11-14 18:55:35.337: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, Rotation: -1
11-14 18:55:35.337: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, mbResultFaceDectection: false
11-14 18:55:35.337: V/WindowOrientationListener(3409): mSContextAutoRotationListener.getProposedRotation, Rotation: -1
11-14 18:55:35.337: V/WindowManager(3409): rotationForOrientationLw(orient=0, last=1); user=0 USER_ROTATION_LOCKED sensorRotation=-1 mLidState=-1 mDockMode=0 mHdmiPlugged=false mAccelerometerDefault=false gripRotationLock=false
Manifest.xml 如下所示。
...
android:configChanges="keyboardHidden|orientation|screenSize"
android:screenOrientation="landscape"
...
对不起我的英语不好。我真的很想解决这个问题。 谁帮帮我!
最佳答案
那么解决方法就很简单了:
把它放在你的 list 中
<android:screenOrientation="landscape">
关于android - 应用程序在 android 中运行时屏幕解锁后黑屏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26927389/