Create a transparent dialog on top of activity

前端 未结 2 1024
庸人自扰
庸人自扰 2021-02-01 01:49

Background

I\'m trying to put a layer on top of the current activity which would have explanation of what is going on on the current screen, similar to what occurs on

相关标签:
2条回答
  • 2021-02-01 02:20

    Just add this, it really works!

    <item name="android:windowIsTranslucent">true</item>
            <item name="android:windowCloseOnTouchOutside">true</item>
            <item name="android:windowBackground">@android:drawable/alert_dark_frame</item>
            <item name="android:windowContentOverlay">@null</item>
            <item name="android:windowNoTitle">true</item>
            <item name="android:windowIsFloating">true</item>
            <item name="android:backgroundDimEnabled">false</item>
    
    0 讨论(0)
  • 2021-02-01 02:24

    Just change the background color of your Dialog:

    dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    

    Edit:

    This prevents the dim effect:

    dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
    
    0 讨论(0)
提交回复
热议问题