2.5 and mask panel transparency

canalrun

Well-Known Member
Licensed User
Longtime User
Hello,
I have an app where I want to make a full-screen semi-transparent mask panel to prevent button presses.

I have several apps compiled with previous versions (2.22 or older) that use mask panels, but in my latest app compiled with version 2.5 when I set the transparency of the mask panel to anything 254 and below the panel becomes completely transparent. If I set the transparency to 255, the panel becomes opaque as expected.

B4X:
dim mp as panel
mp.Initialize("MaskPanel") ' mask panel
Activity.AddView(mp, 0, 0, 100%x, 100%y)
mp.Color = Colors.ARGB(254, 0,0,0) ' 255 opaque, <= 254 completely transparent
mp.BringToFront

I have tested on devices with Android versions ranging from 2.3 to the latest.

Any ideas?

Thanks,
Barry.

--- Added Later ---
I just modified the code.
Instead of dynamically creating the panel, mp, I created the panel in the designer.
Now when I set the color to semi-transparent it behaves as expected.
It does not appear to be a 2.5 problem but a difference between dynamically creating the panel or statically creating the panel in the designer.
There must be some property set in the designer that I am not setting when I create the panel dynamically.

Does anyone know what this could be?

Thanks again,
Barry.
 
Last edited:

JonPM

Well-Known Member
Licensed User
Longtime User
What alpha is set in the Designer for the panel (at the bottom of the designer)?
 
Upvote 0

canalrun

Well-Known Member
Licensed User
Longtime User
Hello,
When I use a static panel, defined in the Designer, I have the alpha set for 100 and the color set for black.

When I was creating the panel dynamically, initially I had the alpha set for 100 and the color set for black. The mask panel was always showing as completely transparent. I know the panel was there because the buttons were successfully being masked. I then changed the alpha to 255 and the color to black in my dynamically created panels. The panel showed up as black opaque – good. I then set the alpha to 254 keeping the color black. The panel became completely transparent.

Statically defining the panel in the Designer, setting the alpha to 100 and color to black causes the mask panel to be semi transparent, as desired.

Dynamically creating the panel, setting the alpha to 100 and color to black results in a completely transparent mask panel.

I got the same results when I compiled in 2.5 and 2.2. I don't believe it's a version issue. It seems like something is not being initialized when I dynamically create the panel.

Thanks,
Barry.
 
Last edited:
Upvote 0
Top