首先在res/drawable文件夹下定义圆角显示背景bg.xml。内容如下:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas./apk/res/android" >
<gradient android:startColor="#c0000000" android:endColor="#c0000000" android:angle="90" />
<solid android:color="#00000000" />
<stroke android:width="8dp" android:color="#726DB0" />
<corners android:topLeftRadius="15px"
android:topRightRadius="15px" android:bottomLeftRadius="15px"
android:bottomRightRadius="15px"/>
<padding
android:left="20dp"
android:top="20dp"
android:right="20dp"
android:bottom="20dp" />
</shape>
其次在res/values文件夹下定义styles.xml文件, 内容如下:
<resources>
<style name="mystyle" parent="android:style/Theme.Dialog">
<item name="android:windowBackground">@drawable/bg</item>
</style>
</resources>
最后在AndroidManifest.xml文件中在要呈现的Activity中设置<activity android:name=".MyActivity" android:theme="@style/mystyle"/>就ok了!