我们可以在MainActivity中获取屏幕宽度后动态赋值给侧滑菜单。
在oncreate时
DisplayMetrics metric = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metric);
windowsWight = metric.widthPixels;
windowsHeight = metric.heightPixels;
View leftMenu = findViewById(R.id.left_menu);
LayoutParams leftParams = leftMenu.getLayoutParams();
leftParams.height = windowsHeight;
leftParams.width = windowsWight;
leftMenu.setLayoutParams(leftParams);