一、前言
Taskbar是Android高版本给大屏幕设备定制的快捷导航条,屏幕宽度或者高度达到一定程度,就会判断为平板而显示taskbar。
/*** Returns {@code true} if the bounds represent a tablet.*/public boolean isTablet(WindowBounds bounds) {return smallestSizeDp(bounds) >= MIN_TABLET_WIDTH;}
二、修改验证
其实Lineageos有开关来控制,而且判断的地方比较多,我们稳妥起见,直接修改设置来实现。
先给Launcer加两个权限
<uses-permission android:name="lineageos.permission.WRITE_SETTINGS" /><uses-permission android:name="android.permission.WRITE_SETTINGS"/>
然后onCreate的时候判断并设置一下
@Override@TargetApi(Build.VERSION_CODES.S)protected void onCreate(Bundle savedInstanceState) {if(LineageSettings.System.getInt(this.getContentResolver(),LineageSettings.System.ENABLE_TASKBAR,0)!=1){LineageSettings.System.putInt(this.getContentResolver(),LineageSettings.System.ENABLE_TASKBAR,1);}//**省略**//
}
编译后直接安装,taskbar成功展示