1.修改底部虚拟按钮的高度,打开:android-11.0/frameworks/base/core/res/res/values/dimens.xml
<!-- Height of the bottom navigation / system bar. -->
<dimen name="navigation_bar_height">48dp</dimen>
<!-- Height of the bottom navigation bar in portrait; often the same as @dimen/navigation_bar_height -->
<dimen name="navigation_bar_height_landscape">48dp</dimen>
把两个48dp,改成0dp,这样底部操作的区域的高度就变成了0dp,就会失去了导航键的功能。
2.把虚拟按钮高度设置成0dp高度,但是系统还会绘制虚拟按钮,还需要修改一个地方,打开:android-11.0frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationHandle.java,找到代码:
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
// Draw that bar
int navHeight = getHeight();
int height = mRadius * 2;
int width = getWidth();
int y = (navHeight - mBottom - height);
//canvas.drawRoundRect(0, y, width, y + height, mRadius, mRadius, mPaint);
}
这里就是绘制底部虚拟按钮的方法,只要注释绘制的代码,这样底部的按钮就不会出来了。至此就彻底完成了去掉虚拟导航的功能了。