效果图:
public static void showPhoneDialog(final Context context,
) {
final AlertDialog alertDialog = new AlertDialog.Builder(context)
.create();
if (!((Activity) context).isFinishing()) {
alertDialog.show();
}
final Window window = alertDialog.getWindow();
window.getDecorView().setBackgroundColor(context.getResources().getColor(R.color
.transparency_0));
window.getDecorView().setPadding(0, 0, 0, 0);//关键代码
window.setContentView(R.layout.nm_group_select_phone);
window.setLayout(
window.getContext().getResources().getDisplayMetrics().widthPixels,
LinearLayout.LayoutParams.WRAP_CONTENT);
window.setGravity(Gravity.BOTTOM);
alertDialog.setCanceledOnTouchOutside(true);
}