在Android 15的设备上关闭edge-to-edge功能

Android 15在开发上有很多更新,当APP的targetSdk设置为35,且设备系统为Android 15时,APP会自动启动edge-to-edge功能。虽然可视面积变大了,但界面布局也会受影响。

如果要强制关闭edge-to-edge功能。可以在style.xml中将windowOptOutEdgeToEdgeEnforcement设置为false,并且指定targetApi为35。

然后修改AndroidManifest.xml,将对应activity或application的theme设置为刚才修改的style即可。

参考网址:

https://speakerdeck.com/error96num/edge-to-edge-qiang-zhi-henodui-ying

https://developer.android.com/about/versions/15/behavior-changes-15

https://developer.android.com/reference/android/R.attr#windowOptOutEdgeToEdgeEnforcement
 

你可能感兴趣的:(Android,android)