How to position element at the bottom of a screen using RelativeLayout's constraints?

nicks

How to position element at the bottom of a screen using RelativeLayout's constraints? Currently, I'm using this code:

<Image x:Name="img" Opacity="1"
                VerticalOptions="EndAndExpand"
                RelativeLayout.WidthConstraint=
                  "{ConstraintExpression Type=RelativeToParent, Property=Width}"
                RelativeLayout.HeightConstraint=
                  "{ConstraintExpression Type=RelativeToParent, Property=Height}"/>

To set a picture as a background, however I need it to start from the bottom, therefore, I need to position it at the bottom. How should I do that? I haven't found any examples of that in the internet. Thanks in advance!

Rohit Vipin Mathews

You can use the RelativeView as your container. The make it FillAndExpand in both Horizontal Options and Vertical Options. So now your screen size is the size of your relative layout.

Now you have an image starting at the left bottom and full width :

<Image x:Name="img" Opacity="1"
                VerticalOptions="EndAndExpand"
                RelativeLayout.WidthConstraint=
                  "{ConstraintExpression Type=RelativeToParent, Property=Width}"
                RelativeLayout.HeightConstraint=
                  "{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.25}"
                RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.75}"/>

Also you can set the Aspect, if your image is of smaller size than the screen.

Aspect - How to size the image within the bounds it is being displayed within (whether to stretch, crop or letterbox).

The Aspect determines how the image will be scaled to fit the display area:

  • Fill - Stretches the image to completely and exactly fill the display area. This may result in the image being distorted.
  • AspectFill - Clips the image so that it fills the display area while preserving the aspect (ie. no distortion).
  • AspectFit - Letterboxes the image (if required) so that the entire image fits into the display area, with blank space added to the top/bottom or sides depending on the whether the image is wide or tall.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to position an element at the bottom of the screen on load but not make it fixed?

From Dev

How to position UICollectionViewCell at bottom of screen?

From Dev

Position an element to the bottom using bootstrap

From Dev

Position a list at the bottom of it's containing element

From Dev

how to center android Textview element at bottom of the screen

From Dev

How to position element on the bottom of its container?

From Dev

Css: Position element by it's bottom relative to it's container's top

From Dev

Position HTML element relative to bottom of parent element using CSS?

From Dev

Position HTML element relative to bottom of parent element using CSS?

From Dev

CSS - Align div in bottom of screen without using position: absolute

From Dev

JAVA - Using Box.createGlue() to position objects at the bottom of the Screen?

From Dev

How to position a child element at the bottom of a fixed position parent

From Dev

Position element at bottom of div

From Dev

How to position a div element on the right side of the screen

From Dev

How can I position the camera on the bottom of the screen on a tilted Map in Android

From Dev

How to keep footer at bottom of screen using jQuery

From Dev

How to fix a footer at bottom using absolute position?

From Dev

Position MBProgressHUD at the Bottom/Top of the screen

From Dev

Unable to position a button to the bottom of screen

From Dev

JS: How to find an element's position on the screen without it being different on different computers?

From Dev

Fade and translate the "position:absolute" element from top to bottom using jquery

From Dev

How to position the element using absolute position?

From Dev

position an element by screen size

From Dev

How to change scrollbar position from bottom to top of the element?

From Dev

How to change scrollbar position from bottom to top of the element?

From Dev

How to keep footer on the bottom without affected by position:absolute element

From Dev

How do I position my element at the bottom of my well?

From Dev

How to findObject in UiAutomator using position on screen (bounds)

From Dev

How to findObject in UiAutomator using position on screen (bounds)

Related Related

  1. 1

    How to position an element at the bottom of the screen on load but not make it fixed?

  2. 2

    How to position UICollectionViewCell at bottom of screen?

  3. 3

    Position an element to the bottom using bootstrap

  4. 4

    Position a list at the bottom of it's containing element

  5. 5

    how to center android Textview element at bottom of the screen

  6. 6

    How to position element on the bottom of its container?

  7. 7

    Css: Position element by it's bottom relative to it's container's top

  8. 8

    Position HTML element relative to bottom of parent element using CSS?

  9. 9

    Position HTML element relative to bottom of parent element using CSS?

  10. 10

    CSS - Align div in bottom of screen without using position: absolute

  11. 11

    JAVA - Using Box.createGlue() to position objects at the bottom of the Screen?

  12. 12

    How to position a child element at the bottom of a fixed position parent

  13. 13

    Position element at bottom of div

  14. 14

    How to position a div element on the right side of the screen

  15. 15

    How can I position the camera on the bottom of the screen on a tilted Map in Android

  16. 16

    How to keep footer at bottom of screen using jQuery

  17. 17

    How to fix a footer at bottom using absolute position?

  18. 18

    Position MBProgressHUD at the Bottom/Top of the screen

  19. 19

    Unable to position a button to the bottom of screen

  20. 20

    JS: How to find an element's position on the screen without it being different on different computers?

  21. 21

    Fade and translate the "position:absolute" element from top to bottom using jquery

  22. 22

    How to position the element using absolute position?

  23. 23

    position an element by screen size

  24. 24

    How to change scrollbar position from bottom to top of the element?

  25. 25

    How to change scrollbar position from bottom to top of the element?

  26. 26

    How to keep footer on the bottom without affected by position:absolute element

  27. 27

    How do I position my element at the bottom of my well?

  28. 28

    How to findObject in UiAutomator using position on screen (bounds)

  29. 29

    How to findObject in UiAutomator using position on screen (bounds)

HotTag

Archive