iNCEPTiON_
iNCEPTiON_

Reputation: 621

Xamarin.Forms button positioning

Im having a very hard time to design my simple UI without a Designer on Xamarin.Forms for Android.Im trying to learn about Xamarin.Forms To get a Picture for what im trying to do i got a Screenshot, thats what i tried so far:

<StackLayout>
  <StackLayout Orientation="Horizontal" VerticalOptions="Start">

  </StackLayout>

  <StackLayout VerticalOptions="CenterAndExpand">
    <Image Source="Login.png"/>
  </StackLayout>

  <StackLayout Orientation="Vertical" VerticalOptions="End">
    <Button Text="Start"/>
    <Button Text="Login"/>
  </StackLayout>
</StackLayout>

enter image description here

EDIT: With my Code im getting 2 small buttons at the Buttom and, i dont know why, can you just guide me in the right direction. Just want to know how i can position my controls to look like the screenshot

Upvotes: 0

Views: 2301

Answers (2)

Alex
Alex

Reputation: 3889

  1. Why your stackpanel for buttons have vertical orientation? This will place them one under another;
  2. You can try setting the stackpanel's horizontal alignment to Stretch;
  3. I think using the Grid will be a better approach (look at Egor's answer)

Upvotes: 0

Yehor Hromadskyi
Yehor Hromadskyi

Reputation: 3388

<Grid>
  <Grid.RowDefinitions>
    <RowDefinition/>
    <RowDefinition Height="80"/>
  </Grid.RowDefinitions>

  <Image/>

  <Grid Grid.Row="1">
    <Grid.ColumnDefinitions>
      <ColumnDefinition/>
      <ColumnDefinition/>
    </Grid.ColumnDefinitions>

    <Button/>
    <Button Grid.Column="1"/>
  </Grid>
</Grid>

Upvotes: 3

Related Questions