1 In your style.xml file add the below code-
<style name="TransparentDialog" parent="Theme.AppCompat.Dialog">
<item name="android:windowFrame">@null</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:layout_gravity">top</item>
<item name="android:windowMinWidthMajor">95%</item>
<item name="android:windowMinWidthMinor">95%</item>
<item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowIsFloating">true</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:windowCloseOnTouchOutside">true</item>
<item name="android:windowFullscreen">true</item>
</style>
2 In your manifest.xml, which activity you want to make like dialog(If possible this activity only extends "Actvity", try to avoid use "AppCompatActivity" and don't define screenorientation property of this activity. it cause the runtime exception in some device. the screen orientation take the parent activity.), just add the theme and your work is done. just run and see the output.
<activity android:name=".YourActivity"
android:theme="@style/TransparentDialog"/>
No comments:
Post a Comment