在style.xml中写
<resources>
<style name="dialog" parent="@android:style/Theme.Dialog">
<item name="android:windowFrame">@null</item>
<!-- 边框 -->
<item name="android:windowIsFloating">true</item>
<!-- 是否浮现在activity之上 -->
<item name="android:windowIsTranslucent">false</item>
<!-- 半透明 -->
<item name="android:windowNoTitle">true</item>
<!-- 无标题 -->
<item name="android:windowBackground">@color/transparent</item>
<!-- 背景透明 -->
<item name="android:backgroundDimEnabled">false</item>
<!-- 模糊 -->
<item name="android:textColor">#2e3d47</item>
</style>
</resources>
在使用的时候用
new Dialog(this, R.style.dialog);
activity使用透明效果
在manifest.xml中的activity里添加
android:theme="@android:style/Theme.Translucent.NoTitleBar"