StackLayout's vertical alignment












0















I'm trying to put a button at the bottom of a StackLayout and it's not working.
I don't know what I'm doing wrong!



enter image description here



Here's my template:



<Page actionBarHidden="true">
<GridLayout rows="*, *, *, *" columns="*">
<StackLayout horizontalAlignment="center"
verticalAlignment="center">
<Label text="My Account" id="login-label"/>
</StackLayout>
<CardView row="1" class="cardStyle" margin="10"
elevation="40"
radius="4"
verticalAlignment="center"
horizontalAlignment="center"
rowSpan="2"
id="login-box">
<StackLayout id="form-container">
<TextField hint="Login"/>
<TextField hint="Password"/>
<Label text="Forgot password?" horizontalAlignment="right"/>
<Button text="Button" @tap="loginButton()" verticalAlignment="bottom"/>
</StackLayout>
</CardView>
</GridLayout>
</Page>


Thank you!










share|improve this question



























    0















    I'm trying to put a button at the bottom of a StackLayout and it's not working.
    I don't know what I'm doing wrong!



    enter image description here



    Here's my template:



    <Page actionBarHidden="true">
    <GridLayout rows="*, *, *, *" columns="*">
    <StackLayout horizontalAlignment="center"
    verticalAlignment="center">
    <Label text="My Account" id="login-label"/>
    </StackLayout>
    <CardView row="1" class="cardStyle" margin="10"
    elevation="40"
    radius="4"
    verticalAlignment="center"
    horizontalAlignment="center"
    rowSpan="2"
    id="login-box">
    <StackLayout id="form-container">
    <TextField hint="Login"/>
    <TextField hint="Password"/>
    <Label text="Forgot password?" horizontalAlignment="right"/>
    <Button text="Button" @tap="loginButton()" verticalAlignment="bottom"/>
    </StackLayout>
    </CardView>
    </GridLayout>
    </Page>


    Thank you!










    share|improve this question

























      0












      0








      0








      I'm trying to put a button at the bottom of a StackLayout and it's not working.
      I don't know what I'm doing wrong!



      enter image description here



      Here's my template:



      <Page actionBarHidden="true">
      <GridLayout rows="*, *, *, *" columns="*">
      <StackLayout horizontalAlignment="center"
      verticalAlignment="center">
      <Label text="My Account" id="login-label"/>
      </StackLayout>
      <CardView row="1" class="cardStyle" margin="10"
      elevation="40"
      radius="4"
      verticalAlignment="center"
      horizontalAlignment="center"
      rowSpan="2"
      id="login-box">
      <StackLayout id="form-container">
      <TextField hint="Login"/>
      <TextField hint="Password"/>
      <Label text="Forgot password?" horizontalAlignment="right"/>
      <Button text="Button" @tap="loginButton()" verticalAlignment="bottom"/>
      </StackLayout>
      </CardView>
      </GridLayout>
      </Page>


      Thank you!










      share|improve this question














      I'm trying to put a button at the bottom of a StackLayout and it's not working.
      I don't know what I'm doing wrong!



      enter image description here



      Here's my template:



      <Page actionBarHidden="true">
      <GridLayout rows="*, *, *, *" columns="*">
      <StackLayout horizontalAlignment="center"
      verticalAlignment="center">
      <Label text="My Account" id="login-label"/>
      </StackLayout>
      <CardView row="1" class="cardStyle" margin="10"
      elevation="40"
      radius="4"
      verticalAlignment="center"
      horizontalAlignment="center"
      rowSpan="2"
      id="login-box">
      <StackLayout id="form-container">
      <TextField hint="Login"/>
      <TextField hint="Password"/>
      <Label text="Forgot password?" horizontalAlignment="right"/>
      <Button text="Button" @tap="loginButton()" verticalAlignment="bottom"/>
      </StackLayout>
      </CardView>
      </GridLayout>
      </Page>


      Thank you!







      nativescript nativescript-vue






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 13 '18 at 9:52









      khalid karamkhalid karam

      174




      174
























          1 Answer
          1






          active

          oldest

          votes


















          1














          StackLayout do not support that by its design. It is used to just stack the child elements one after another in given orientation, you can't have mixed output - few child elements at top and few at bottom or center.



          Use Grid / Dock layout in order to dock an element at bottom.






          share|improve this answer
























          • but there's an example in the documentation where they are using StackLayout and aligning its children: docs.nativescript.org/ui/layouts/layout-containers#stacklayout The last example, _ Example for vertical alignment of children_.

            – khalid karam
            Nov 13 '18 at 15:43













          • @khalidkaram I think that works in the documentation because they're setting the height of the StackLayout explicitly. I think Manoj is correct, you'd be better off using a grid

            – KrusherKailash
            Nov 13 '18 at 16:15






          • 1





            Yes, but they are showcasing about using horizontal alignment in vertical layout and vice versa. Not vertical alignment in vertical layout.

            – Manoj
            Nov 13 '18 at 16:16











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53278228%2fstacklayouts-vertical-alignment%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          StackLayout do not support that by its design. It is used to just stack the child elements one after another in given orientation, you can't have mixed output - few child elements at top and few at bottom or center.



          Use Grid / Dock layout in order to dock an element at bottom.






          share|improve this answer
























          • but there's an example in the documentation where they are using StackLayout and aligning its children: docs.nativescript.org/ui/layouts/layout-containers#stacklayout The last example, _ Example for vertical alignment of children_.

            – khalid karam
            Nov 13 '18 at 15:43













          • @khalidkaram I think that works in the documentation because they're setting the height of the StackLayout explicitly. I think Manoj is correct, you'd be better off using a grid

            – KrusherKailash
            Nov 13 '18 at 16:15






          • 1





            Yes, but they are showcasing about using horizontal alignment in vertical layout and vice versa. Not vertical alignment in vertical layout.

            – Manoj
            Nov 13 '18 at 16:16
















          1














          StackLayout do not support that by its design. It is used to just stack the child elements one after another in given orientation, you can't have mixed output - few child elements at top and few at bottom or center.



          Use Grid / Dock layout in order to dock an element at bottom.






          share|improve this answer
























          • but there's an example in the documentation where they are using StackLayout and aligning its children: docs.nativescript.org/ui/layouts/layout-containers#stacklayout The last example, _ Example for vertical alignment of children_.

            – khalid karam
            Nov 13 '18 at 15:43













          • @khalidkaram I think that works in the documentation because they're setting the height of the StackLayout explicitly. I think Manoj is correct, you'd be better off using a grid

            – KrusherKailash
            Nov 13 '18 at 16:15






          • 1





            Yes, but they are showcasing about using horizontal alignment in vertical layout and vice versa. Not vertical alignment in vertical layout.

            – Manoj
            Nov 13 '18 at 16:16














          1












          1








          1







          StackLayout do not support that by its design. It is used to just stack the child elements one after another in given orientation, you can't have mixed output - few child elements at top and few at bottom or center.



          Use Grid / Dock layout in order to dock an element at bottom.






          share|improve this answer













          StackLayout do not support that by its design. It is used to just stack the child elements one after another in given orientation, you can't have mixed output - few child elements at top and few at bottom or center.



          Use Grid / Dock layout in order to dock an element at bottom.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 13 '18 at 11:50









          ManojManoj

          5,0502921




          5,0502921













          • but there's an example in the documentation where they are using StackLayout and aligning its children: docs.nativescript.org/ui/layouts/layout-containers#stacklayout The last example, _ Example for vertical alignment of children_.

            – khalid karam
            Nov 13 '18 at 15:43













          • @khalidkaram I think that works in the documentation because they're setting the height of the StackLayout explicitly. I think Manoj is correct, you'd be better off using a grid

            – KrusherKailash
            Nov 13 '18 at 16:15






          • 1





            Yes, but they are showcasing about using horizontal alignment in vertical layout and vice versa. Not vertical alignment in vertical layout.

            – Manoj
            Nov 13 '18 at 16:16



















          • but there's an example in the documentation where they are using StackLayout and aligning its children: docs.nativescript.org/ui/layouts/layout-containers#stacklayout The last example, _ Example for vertical alignment of children_.

            – khalid karam
            Nov 13 '18 at 15:43













          • @khalidkaram I think that works in the documentation because they're setting the height of the StackLayout explicitly. I think Manoj is correct, you'd be better off using a grid

            – KrusherKailash
            Nov 13 '18 at 16:15






          • 1





            Yes, but they are showcasing about using horizontal alignment in vertical layout and vice versa. Not vertical alignment in vertical layout.

            – Manoj
            Nov 13 '18 at 16:16

















          but there's an example in the documentation where they are using StackLayout and aligning its children: docs.nativescript.org/ui/layouts/layout-containers#stacklayout The last example, _ Example for vertical alignment of children_.

          – khalid karam
          Nov 13 '18 at 15:43







          but there's an example in the documentation where they are using StackLayout and aligning its children: docs.nativescript.org/ui/layouts/layout-containers#stacklayout The last example, _ Example for vertical alignment of children_.

          – khalid karam
          Nov 13 '18 at 15:43















          @khalidkaram I think that works in the documentation because they're setting the height of the StackLayout explicitly. I think Manoj is correct, you'd be better off using a grid

          – KrusherKailash
          Nov 13 '18 at 16:15





          @khalidkaram I think that works in the documentation because they're setting the height of the StackLayout explicitly. I think Manoj is correct, you'd be better off using a grid

          – KrusherKailash
          Nov 13 '18 at 16:15




          1




          1





          Yes, but they are showcasing about using horizontal alignment in vertical layout and vice versa. Not vertical alignment in vertical layout.

          – Manoj
          Nov 13 '18 at 16:16





          Yes, but they are showcasing about using horizontal alignment in vertical layout and vice versa. Not vertical alignment in vertical layout.

          – Manoj
          Nov 13 '18 at 16:16


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53278228%2fstacklayouts-vertical-alignment%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Florida Star v. B. J. F.

          Danny Elfman

          Lugert, Oklahoma