Android Question correct positioning and size independent of the device

Discussion in 'Android Questions' started by ThePuiu, May 9, 2019.

  1. ThePuiu

    ThePuiu Active Member Licensed User

    I want to display a 480x105 pixel logo in the middle of the window and the image to be on the full width of the screen if it has the width of 480 or to center without destroying the aspect ratio if the screen size is larger of 480. Which is the best approach? Variant is 320x480x1 and AutoScaleAll is enabled.
    Thank you!
     
  2. JohnC

    JohnC Well-Known Member Licensed User

    Don't use anchors on the imageview displaying the image, and use module code or a designer script to center the imageview on the display.
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    Designer script:
    Code:
    ImageView1.Width = Min(480100%x)
    ImageView1.Height = ImageView1.Width * 
    105/480
    ImageView1.HorizontalCenter = 
    50%x
    ImageView1.VerticalCenter = 
    50%y
     
  4. ThePuiu

    ThePuiu Active Member Licensed User

    Thank you, both of you!
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice