Background image

volvomann

Active Member
Licensed User
Longtime User
Hallo can i use a picture as bacground behind buttons anand labels. if yes how can i do that?
 

margret

Well-Known Member
Licensed User
Longtime User
In the designer layout of your .bal file, select the button you want, scroll down to where is says Drawable. Change this to read Statelist Drawable, then under it, change ColorDrawable to BitmapDrawable. You will then see a location for the filename. Be sure to add your images to the layout file on the right hand side.
 
Upvote 0

Arf

Well-Known Member
Licensed User
Longtime User
I've got a label that I need to draw 1 of 2 different images to the background, depending on device orientation.
I tried putting this in the designer's script, but it doesn't compile:
label1.SetBackgroundImage("wave.bmp")
Any tips?
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Any error message you dont tell us?
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
You should put the below line in your code after loadlayout, not in the designer script:
B4X:
Label1.SetBackgroundImage(LoadBitmap(File.DirAssets,"wave.bmp"))
 
Upvote 0
Top