我尝试用这样的风格强制“全屏”:
<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;
}
但我总是得到这个Screenshot
任何想法如何解决这个问题?
答案 0 :(得分:1)
将以下内容添加到<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
答案 1 :(得分:0)
尝试添加
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);