BottomSheetDialog 找不到符号design_bottom_sheet

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

posted @ 2022-08-20 12:30  jiduoduo  阅读(767)  评论(0编辑  收藏  举报