对话框全屏透明

在drawable中建立shape的xml文件
           egame_fillbox.xml

            <?xml version="1.0" encoding="utf-8"?>
            <shape xmlns:android="http://schemas.android.com/apk/res/android">

                  <padding android:left="0dp" android:top="0dp"
                      android:right="0dp" android:bottom="0dp" />
            </shape>
            2、在values中style中增加

            <style name="my_dialog" parent="@android:style/Theme.Dialog">
                    <item name="android:windowNoTitle">true</item>
                    <item name="android:windowBackground">@drawable/egame_fillbox</item>
            </style>
            3、Dialog  mTableDialog = new Dialog(this,R.style.my_dialog);

                  mTableDialog.setContentView(mSetTableLayout);
                  mSetTableLayout为你对话框的布局。
    WindowManager.LayoutParams lp = dialog.getWindow().getAttributes();
        lp.alpha = 0.5f; // 0.0-1.0
        dialog.getWindow().setAttributes(lp);
posted @ 2012-05-23 16:06  meieiem  阅读(584)  评论(0编辑  收藏  举报