Android Question Panel with cut out window

Discussion in 'Android Questions' started by MoraviaVenus, Apr 30, 2015.

  1. MoraviaVenus

    MoraviaVenus Member Licensed User

    Hi all,

    please, is it possible to create an element in B4A, which will behave like window? I mean e.g. combination of two red panels covering each other, where the intersection will be transparent (or let's say cut out).

    Example is attached (over the picture with horse there is red panel with window).

    Thank you.

  2. NJDude

    NJDude Expert Licensed User

    No need to be a panel, create a PNG with a "transparent" window.
    walterf25 likes this.
  3. MoraviaVenus

    MoraviaVenus Member Licensed User

    Good idea, but, unfortunately, I need to manage the size of the overall object (has to be size of screen) and the size of transparent window.

    Any other suggestions, please?
  4. MoraviaVenus

    MoraviaVenus Member Licensed User

    In the meantime I implement dirty solution, that works for rectangle window. It is composed from four separate panels:


    More challenging will it be with rounded window :)
  5. MaFu

    MaFu Well-Known Member Licensed User

    Create a mutable bitmap with your needed dimensions.
    Use paint functions to draw a rect in the bitmap with your favorite color.
    Draw another smaller rect (or circle ;)) with full transparency.
    Now create a BitmapDrawable, initialize it with your bitmap and assign it to the panel background.
    The ABExtDrawing lib can help you with the paint functions.
  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