我尝试在我的样式中强制使用"全屏",如下所示:
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
我从我的活动中尝试过:
getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
我什至尝试过这个,这使得当我按下"全屏显示"按钮时会调用的意图:
public static boolean goToFullScreen(final Activity activity) {
PackageManager packageManager = activity.getPackageManager();
try {
if ("huawei".equalsIgnoreCase(android.os.Build.MANUFACTURER)) {
final Intent huaweiIntent = new Intent();
huaweiIntent.setComponent(new ComponentName("com.android.systemui", "com.android.systemui.settings.HwChangeButtonActivity"));
if (huaweiIntent.resolveActivity(packageManager) != null) {
activity.startActivity(huaweiIntent);
return true;
}
}
} catch (Exception e) {
Utils.appendLog("goToBatterySettings exception:" + e.getMessage(), "E", Constants.OTHER);
}
return false;
}
但我总是得到这个截图
任何想法如何解决这个问题?
将以下内容添加到<application>
元素:
<meta-data android:name="android.max_aspect" android:value="2.1" />
请参阅:https://android-developers.googleblog.com/2017/03/update-your-app-to-take-advantage-of.html
尝试添加
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);