B4J Question [ABMaterial]: Solved: How to not stretch the background image yet fill whole screen?

Mashiane

Expert
Licensed User
Longtime User
Hi there

I have set up a background image and currently it stretches and looks ugly. How do I not stretch it however ensure that the whole background of my page plays nicely with the pick?

Thanks.

welcome.png
 

Cableguy

Expert
Licensed User
Longtime User
Set the gravity to center and make sure the image size is large enough to cover the whole screen
 
Upvote 0

Mashiane

Expert
Licensed User
Longtime User
Thanks @Cableguy , after much exploring, I figured out that perhaps if...

1. I dont set the SetBackgroundImage method on the page and
2. Add
B4X:
page.InjectCss($"body { background-image: url("../images/cont_bg.png") !important; background-repeat: repeat !important; }"$)

Passing the path to my image, it would work.

And it did. I guess I also need to learn some css things going forward.
 
Upvote 0
Top