//设置适配
//Top1:获取windowManager管理器
WindowManager windowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
//Top2:获取手机默认的显示屏
Display display = windowManager.getDefaultDisplay();
//Top3:初始化密度对象
DisplayMetrics metrics = new DisplayMetrics();
//Top4:获取屏幕的密度
display.getMetrics(metrics);
//Top5:设置宽度为原有的2/3
int width = metrics.widthPixels/3*2;
//Top:设置控件
ViewGroup.LayoutParams layoutParams = navigationView.getLayoutParams();
layoutParams.width = width;