难题描述:H5页面播放 ,锁屏,解锁后,重新加载了页面,三星不会出现(onpause onstop ,onresume),但在小米、魅族会调用 onpause onstop ondestroy,onresume

为了解决 ,解锁后能呈现和锁屏前一样的页面,寻找了下横竖屏时的生命周期的问题,

解决办法就是 阻止横竖屏的切换

在Android 2.3平台上,我们可以需要设置界面的横竖屏显示时,可以在AndroidManifest.xml中,对Activity的属性添加以下代码:

android:configChanges="orientation"

Android4.0以后 ,我们要在AndroidManifest.xml中的Activity加入以下属性:

android:configChanges="orientation|screenSize"

 

例如:

<activity android:name="com.gaosi.beike.downloadprovider.TestHTML5WebView"
android:screenOrientation="landscape"
android:configChanges="orientation|screenSize"
>

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-20
  • 2021-09-10
  • 2021-12-05
  • 2022-01-11
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-10
  • 2022-12-23
  • 2022-12-23
  • 2021-06-29
  • 2019-07-15
相关资源
相似解决方案