1,在你的styles.xml文件中可以新建一如下的style:
<style name="Theme.FloatActivity" parent="android:style/Theme.Dialog">
<!-- float_box为我们定义的窗口背景 ,这个不是必须的-->
<item name="android:windowBackground">@drawable/float_box</item></style>
如果窗口要添加窗口背景,可以在drawable中新建一个叫float_box.xml的文件,内容可以如下(自定义):
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="#ffffff" />
<stroke
android:width="3dp"
android:color="#000000" />
<corners android:radius="5dp" />
<padding
android:bottom="10dp"
android:left="10dp"
android:right="10dp"
android:top="10dp" />
</shape>
2.在AndroidManifest.xml中在你需要显示为窗口的activity中添加如果属性:android:theme=”@style/Theme.FloatActivity” 即可
如果说您觉得新建style.xml及float_box.xml文件的方式麻烦或者只想Test一下,那么可以直接添加您对应需要展示为 Dialog style的Activity的android:theme属性值为 android:theme=”@android:style/Theme.Dialog”。