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
    18 KB · Views: 129
  • Ekran Alıntısı2.PNG
    17.5 KB · Views: 108
  • Ekran Alıntısı3.PNG
    19 KB · Views: 118
  • Ekran Alıntısı4.PNG
    26.8 KB · Views: 125

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
    71.5 KB · Views: 125
  • Ekran Alıntısı2.PNG
    74.3 KB · Views: 110
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
Cookies are required to use this site. You must accept them to continue using the site. Learn more…