最新的三星的智能手机具有有趣的功能,称为全屏(或在营销术语中 infinity Display (。在此模式下,应用程序还涵盖了"主页/背"按钮所在的显示的一部分。通常的应用程序不涵盖此区域,而将其留黑。但是三星的土地覆盖了这一区域。
问题:如何实现这一效果?我的意思是我应该使用什么样的清单声明或编程呼叫(可能是三星的遗产API(?
启用新的Samsung Galaxy S8和LG G6全屏支持添加到<application>
元素下的AndroidManifest.xml:
<meta-data android:name="android.max_aspect" android:value="2.1" />
其中2.1的值是纵横比18.5:9(默认情况下,您的应用程序默认值与16:9-1.86的最大比率(。更多信息:Android博客。
另外,您可以为应用程序或活动设置以下属性:
android:resizeableActivity="true"
由于文档状态(链接(:
如果活动的 Android:重新分裂性属性设置为true。如果您的应用程序 目标API级别24或更高,此属性默认为true。
要获得全屏幕,您必须过度过度 onwindowfocuschanged 方法,并创建 docorview 对象,然后添加System_ui标志。.
@Override
public void onWindowFocusChanged(boolean hasFocus){
super.onWindowFocusChanged(hasFocus);
View decorView = getWindow().getDecorView();
if(hasFocus){
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY // this flag do=Semi-transparent bars temporarily appear and then hide again
|View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN // Make Content Appear Behind the status Bar
|View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION // it Make Content Appear Behind the Navigation Bar
|View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
|View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
}
}
可以关闭。我将本教程用于我的S8
如何在Galaxy S8/S8