先看一下效果:
布局很简单,background 设置为透明就行。
代码也很简单,其中最主要的就是:
mDialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
下面是完整代码
AlertDialog.Builder builder = new AlertDialog.Builder(Context); View view = View.inflate(Context, your view, null); builder.setView(view); AlertDialog mDialog = builder.create(); mDialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent); mDialog.show();