Android 带有alpha后视图的弹出窗口

Android 带有alpha后视图的弹出窗口,android,popup,android-alertdialog,Android,Popup,Android Alertdialog,如何做到这一点,我实际上有以下代码: public void openDialog() { final Dialog dialog = new Dialog(this); // Context, this, etc. dialog.setContentView(R.layout.fragment_wrongpass_reg); dialog.setTitle("cualquier cosa"); dialog.show(); } 我需要使用alpha将屏幕放在后

如何做到这一点,我实际上有以下代码:

public void openDialog() {
    final Dialog dialog = new Dialog(this); // Context, this, etc.
    dialog.setContentView(R.layout.fragment_wrongpass_reg);
    dialog.setTitle("cualquier cosa");
    dialog.show();
}
我需要使用alpha将屏幕放在后屏幕上,使其几乎透明,如下图所示:


您需要创建一个全屏对话框,并将其设置为自定义主题

创建一个全屏对话框,并使用内部填充设置其内容。 大概是这样的:

 <RelativeLayout
   xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   android:background="#cb000000"
   android:padding="20dp">
   <LinearLayout
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:layout_centerInParent="true"
       android:orientation="vertical"
       ....
       ....
       YOUR CONTENT
       ....
       ..../>
 </RelativeLayout>
final dialog = new Dialog(context, R.style.Dialog_Fullscreen);

不工作,可能是我搞错了…我把最后一行添加到:final Dialog=new Dialog(这个,R.style.Dialog\u全屏);setContentView(R.layout.fragment\u errowpass\u reg);对话框。设置标题(“错误通过”);dialog.show();主题仅适用于全屏。。诀窍在于使用填充的布局。您的布局看起来像我的示例?
final dialog = new Dialog(context, R.style.Dialog_Fullscreen);