Android Question Getting a background image

SPLatMan

Member
Licensed User
Longtime User
Hi, I am having trouble getting my app to display a background image. I suspect I am using panels and canvas badly. The attached program illustrates the problem. It is heavily stripped down from my full app.

As-is the demo app will display a few buttons and some text on a plain background. If you uncomment line 98
B4X:
    'MakeBGImage        '<<<<<<<<<<<<<<<<<<<<<<  Comment out to show the text
it will show an image of the reward offered for a solution but the text, and its associated background panel, will vanish.

Any suggestions, please?
 

Attachments

  • BackgroundImgChallenge.zip
    26 KB · Views: 126

klaus

Expert
Licensed User
Longtime User
The probelm in your code is that you add a Panel with an image on the Activity.
Then you try to send it to back.
Unfortunately a Panel cannot be behind the Activity !
You should change the code to draw the image on the Activity background and draw the text on a Panel.
Attached your modified test program.
If you want to show and hide the image you could either change the Activity background or draw the image on a Panel and change the Visibility property.
 

Attachments

  • BackgroundImgChallenge_1.zip
    25.3 KB · Views: 134
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…