---
title: "Android AlertDialog去除白色边框"
author: "chjmars"
date: "2011-08-12T13:33:47Z"
tags: ["Android AlertDialog"]
categories: ["移动开发"]
slug: "android-alertdialog"
draft: false
lastmod: "2011-08-19T21:46:24Z"
id: 1147303
url: "https://chjmars.iteye.com/blog/1147303"
---

使用styles.xml风格：

 

```
<style name="FullScreenDialog" parent="android:style/Theme.Dialog">
	<item name="android:windowNoTitle">true</item>
	<item name="android:windowFrame">@null</item>
	<item name="android:windowIsFloating">true</item>
	<item name="android:windowIsTranslucent">false</item>
	<item name="android:background">@android:color/black</item>
	<item name="android:windowBackground">@null</item>
	<item name="android:backgroundDimEnabled">false</item>
</style>
```

 

 使用AlertDialog的上层接口类：

 

```
Dialog reNameDialog = new Dialog(getContext(), R.style.FullScreenDialog);
LayoutInflater mLayoutInflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View reNameView = mLayoutInflater.inflate(R.layout.audiorecord_rename, null);
LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
reNameDialog.addContentView(reNameView, params);
reNameDialog.show();
```