Android Question How can I resize and position an ImageView on different size screens

pjetson

Member
Licensed User
Longtime User
I am having trouble with an ImageView on different size screens. I usually work with my Nexus 4, and everything looks great there. However, on other devices with different size screens, the ImageView is not being resized as I'd like it. I am using a Designer script to adjust the size of the views.

The ImageView is mean to take up as much of the screen as is possible below the two buttons, subject to keeping the image's aspect ratio. The text on the two labels is meant to appear in front of the image.

On my Nexus 4, the image appears exactly as I expect it to. On other devices, though, the buttons and labels are correctly resized, but the image is not. For example, on a no-name tablet that I have, the image is much smaller than I expect.

I have attached a small project that shows the problem. Can anyone see what I'm doing wrong?

Thanks, Peter
 

Attachments

  • positioning.zip
    17.7 KB · Views: 205

Erel

B4X founder
Staff member
Licensed User
Longtime User
Use anchors when possible.

Start with something like this:

SS-2017-09-07_08.30.15.png


No designer script at all except of AutoScaleAll.
 
Upvote 0
Top