a.首先为这个半透明弹窗新建一个名为dialog.xml的Layout
b.res/values文件夹新建名为 dialogStyle.xml的resources样式文件,具体代码如下:
c.
注:本文取自于网络
b.res/values文件夹新建名为 dialogStyle.xml的resources样式文件,具体代码如下:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="dialog" parent="@android:style/Theme.Dialog">
<item name="android:windowFrame">@null</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowIsTranslucent">false</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowBackground">@drawable/dia_bg</item>
<item name="android:backgroundDimEnabled">false</item>
</style>
</resources>
c.
View diaView=View.inflate(this, R.layout.dialog, null);
dialog=new Dialog(AuthorizeActivity.this,R.style.dialog);//这里应用了你的自定义样式
dialog.setContentView(diaView);
dialog.show();
注:本文取自于网络