B4A Library [B4X] [BitmapCreator] BlurredDialog

Discussion in 'Additional libraries, classes and official updates' started by Erel, Apr 22, 2018.

  1. Erel

    Erel Administrator Staff Member Licensed User



    This class uses BitmapCreator to blur the background and show a panel at the center of the screen.
    It is compatible with B4A, B4J and B4i.

    Call Show to blur the background and show a panel.
    Call Close to hide the panel and remove the blurring.

    Usage example:
    Sub ShowBlurredDialog_Example
    Dim p As B4XView = xui.CreatePanel("")
       DialogCLV.DefaultTextBackgroundColor = xui.Color_Transparent
       DialogCLV.sv.Color = xui.Color_Transparent
    For i = 1 To 30
    "Item #" & i, i)
       BlurredDialog1.Show(BasePanel.Parent, p)
    Wait For DialogCLV_ItemClick (Index As Int, Value As Object)
    Log("Selected value: " & Value)
    Wait For (BlurredDialog1.Close) Complete (Closed As Boolean)
    End Sub
    Note that Close is a resumable sub as it first animates the panel. The Closed parameter can be used to decide whether the back key was handled in B4A. See the example here: https://www.b4x.com/android/forum/t...r-pixels-drawings-and-more.92050/#post-582791


    1. You can change the BlurScale parameter to make the blurring faster. The higher the value, the faster it will be. Make sure to test performance in release mode.
    2. The effect looks nice when the dialog is semi-transparent. In B4J you need to add a CSS file with this content if you are using xCustomListView:
    .scroll-pane .viewport {
           -fx-background-color: transparent;
    The class is also included in the BitmapCreator example app: https://www.b4x.com/android/forum/threads/92050

    Attached Files:

    Last edited: Apr 22, 2018
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice