Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

311
Visualizações
Half Circle Overlay in Background on the Bottom of Page in Xamarin

I'm working on adding a fix half circle overlay in background on the bottom of page.

Structure of all Pages in App (all pages are responsive)

<ContentPage.Content>
    <StackLayout>
        
        // Top Bar => Icons e.t.c
        <StackLayout VerticalOptions="Start">
        </StackLayout>

        // Center => Content
        <StackLayout HorizontalOptions="CenterAndExpand"
                     VerticalOptions="CenterAndExpand">
        </StackLayout>

        // End => Button
        <StackLayout HorizontalOptions="Center"
                         VerticalOptions="End">
        </StackLayout>

    </StackLayout>
</ContentPage.Content>

Now, I wanted to add an Half Circle Overlay, but I couldn't do that by code, so, I used the Image for this half circle overlay.

I wanted to add it in last StackLayout, but can't put RelativeLayout in StackLayout. So, I remove the last StackLayout and pasted the RelativeLayout code instead.

<RelativeLayout
    HorizontalOptions="End">
    <Image
        Source="drawable/background_halfcircle.png"
        RelativeLayout.WidthConstraint=
        "{ConstraintExpression Type=RelativeToParent, Property=Width}"
        RelativeLayout.HeightConstraint=
        "{ConstraintExpression Type=RelativeToParent, Property=Height}"/>
    <Grid
        RelativeLayout.WidthConstraint=
        "{ConstraintExpression Type=RelativeToParent, Property=Width}"
        RelativeLayout.HeightConstraint=
        "{ConstraintExpression Type=RelativeToParent, Property=Height}">

        <Button
            Text="Button"
            Margin="0,0,0,10"/>
    </Grid>
</RelativeLayout>

Now, the problem is that it pushed all the code in Start & Center StackLayout to the top (stretched it, looking terrible).

How could I add this Half Circle Overlay in the bottom of every page and the above StackLayout aren't get effected?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Easier to overlay using a one-row Grid:

<ContentPage.Content>
    <Grid>
        <!-- Grid Row/Column default to 0. -->
        <StackLayout>
            ... everything that isn't in the overlay ...
        </StackLayout>
        <!-- Grid Row/Column default to 0; so overlaid on StackLayout -->
        <RelativeLayout ...
            ...
        </RelativeLayout>
    </Grid>
</ContentPage.Content>

In fact, I never use RelativeLayout. Can do everything you want using Grid rows and columns.

  • Overlay by specifying same row/column.
  • Proportions using row/column specifiers, e.g. "2*", "3*'.
  • stack-like layouts using "Auto" height or width. (I do use StackLayout when convenient; just mentioning that Grid can incorporate stack-like areas.)

On paper, sketch desired layout. Draw vertical and horizontal lines to separate the areas. Then can determine how to put into a grid. For example, one area might span two columns.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda