Android Question Howto apply "scrim" to image according to Material design principles

fredo

Well-Known Member
Licensed User
Longtime User
According to THIS ("Text protection") it is advised to take actions to ensure that texts on images are readable.

"To make typography legible on top of imagery, apply text protection in the form of scrims. Scrims are lightweight, translucent material layers."




I tried with gradientdrawables (transparent to black) on panels over the image, but that was not helpful.

Does anyone know a better way to achieve this?
 

fredo

Well-Known Member
Licensed User
Longtime User
OK I found a reusable solution for my purposes and thought it might help someone else.

Usage:
B4X:
ScrimLabel(imageview, true, "This is a testtext", "with a subtext", 0.7)




Attached is the B4A project as a ZIP-Export
 

Attachments

  • ScrimLabel.zip
    57.7 KB · Views: 272
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…