BottomSheetDialog使用
BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(mContext); bottomSheetDialog.setContentView(R.layout.layout_bottom_pic_num); //去掉透明遮罩 // if (bottomSheetDialog.getWindow() != null) { // WindowManager.LayoutParams params = bottomSheetDialog.getWindow().getAttributes(); // params.dimAmount = 0.0f; // bottomSheetDialog.getWindow().setAttributes(params); // } FrameLayout bottom = bottomSheetDialog.getWindow().findViewById(com.google.android.material.R.id.design_bottom_sheet); if (bottom != null) { bottom.setBackgroundResource(android.R.color.transparent); } // bottomSheetDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); bottomSheetDialog.show();
解决:
找不到符号 design_bottom_sheet ==> com.google.android.material.R.id.design_bottom_sheet
标签:BottomSheetDialog,sheet,bottom,bottomSheetDialog,design,getWindow From: https://www.cnblogs.com/jiduoduo/p/16607509.html