在AndroidManifest.xml中<activity>中
android:theme="@android:style/Theme.Dialog"
主题已对话框显示;
在MainActivity中添加以下代码:
//设置隐藏标题
requestWindowFeature(Window.FEATURE_NO_TITLE);
//设置activity背景色透明
Drawable drawable = getResources().getDrawable(
android.R.color.transparent);
this.getWindow().setBackgroundDrawable(drawable);