Android Question Responsive Background and Image Buttons

Ydm

Active Member
Licensed User
Longtime User
I've gone through all the questions about Responsive. However, I was unable to do this.
I have one panel. (pnlMain) This panel is set to fill the whole screen.
Inside this panel there is a background image. 1920x1080 in size. Button places are left blank in this background image. (imgMainBg)
For example, I have a Youtube icon. (imgYouTube)
I want to do this. When I set this icon to the corresponding place, how can it scale depending on the background image even if the screen resolution changes? So how can I get the background image to stay in the same place for all sizes?
I will have a lot of button images like this one.
 

Attachments

  • Ekran Alıntısı1.PNG
    Ekran Alıntısı1.PNG
    18 KB · Views: 83
  • Ekran Alıntısı2.PNG
    Ekran Alıntısı2.PNG
    17.5 KB · Views: 66
  • Ekran Alıntısı3.PNG
    Ekran Alıntısı3.PNG
    19 KB · Views: 69
  • Ekran Alıntısı4.PNG
    Ekran Alıntısı4.PNG
    26.8 KB · Views: 79

Ydm

Active Member
Licensed User
Longtime User
Unfortunately I couldn't. For example, I want the button in the middle right to be in the middle right on every screen. I seem to be missing something simple. Because there are much more complicated examples on the forum and it works.
 

Attachments

  • Ekran Alıntısı1.PNG
    Ekran Alıntısı1.PNG
    71.5 KB · Views: 76
  • Ekran Alıntısı2.PNG
    Ekran Alıntısı2.PNG
    74.3 KB · Views: 52
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
Unfortunately I couldn't. For example, I want the button in the middle right to be in the middle right on every screen. I seem to be missing something simple. Because there are much more complicated examples on the forum and it works.
I didn't write about using (only) anchors but about writing a script.
Now I'm not in a good mood to answer better, sorry.
 
Upvote 0

Jeffrey Cameron

Well-Known Member
Licensed User
Longtime User
I think what @LucaMs is saying is that you add a couple of lines to the script area of the designer such as:
B4X:
imgYouTube.VerticalCenter = 50%y
imgYouTube.Right = 100%x - 50dip
Repeat this methodology for each button you need placed.

If you're saying you can't add script code, then perhaps you can explain why you cannot.
 
Upvote 0
Top