There are two methods
Method 1.
1. Set an attribute of the current activity in the androidmanifest. xml file (the built-in attribute ):
Android: theme = "@ Android: style/theme. Dialog"
Method 2.
1. You can create the following style in the styles. xml file:
<Style name = "theme. floatactivity" parent = "Android: style/theme. Dialog">
<! -- Float_box is the defined window background. This is not required -->
<Item name = "Android: windowbackground"> @ drawable/float_box </item>
</Style>
If you want to add a window background, you can create a new file named float_box.xml in drawable. The content can be as follows (custom ):
<? 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" color = "#000000"/>
<Corners Android: radius = "3dp"/>
<Padding Android: Left = "10dp" Android: Top = "10dp" Android: Right = "10dp" Android: Bottom = "10dp"/>
</Shape>
2. In androidmanifest. XML, add the property Android: theme = "@ style/theme. floatactivity" to the activity that you want to display as a window.