我需要像对话框的灰色背景一样以编程方式创建全屏RelativeLayout(它位于每个视图的顶部)。
我试试这个,但 ActionBar 在上面:
rlContainerLayout = new RelativeLayout(activity);
rlContainerLayout.setLayoutParams(new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT , RelativeLayout.LayoutParams.MATCH_PARENT ));
rlContainerLayout.setBackgroundColor(ContextCompat.getColor(activity,R.color.color_gray));
activity.addContentView(rlContainerLayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
那么我怎样才能实现对话框背景之类的东西呢?