Flex Layout Entry Not Centering Text

JoshSchweigertJoshSchweigert ✭✭USMember ✭✭
edited May 2018 in Xamarin.Forms

I have an entry box inside of a flex layout. I want the entry to display across the whole screen with some margin and still have the text/placeholder text centered. I currently cannot get the entry to have it's text centered nor apply a margin to the left and right sides.

What I want:

What I'm getting:

Code Inside a content page and with relevant parts:

<FlexLayout Direction="Column"
                    AlignContent="Center"
                    AlignItems="Center"
                    JustifyContent="SpaceEvenly"
                    HorizontalOptions="FillAndExpand"
                    VerticalOptions="FillAndExpand">
`
`
            <Image Source="Banner.png"
                   Aspect="AspectFit"
                   Scale="0.85"/>

            <StackLayout x:Name="ControlsHolder_StackLayout" 
                         Orientation="Vertical"
                         HorizontalOptions="FillAndExpand"
                         VerticalOptions="FillAndExpand"
                         Spacing="20">

                <Label x:Name="WelcomeMessage_Label"
                       Text="Welcome to the General Aire contractor App.
                             Please enter your general Aire contractor number to begin."
                       HorizontalTextAlignment="Center"
                       HorizontalOptions="CenterAndExpand"
                       TextColor="White"
                       FontSize="Small" />

                <Entry x:Name="ContractorNumber_Entry"
                       HorizontalTextAlignment="Center" 
                       Placeholder="Enter Contractor Number"
                       PlaceholderColor="{StaticResource GFI_Gray}"
                       TextColor="White"
                       FlexLayout.AlignSelf="Center"
                       HorizontalOptions="FillAndExpand">
                </Entry>
Tagged:

Answers

  • ClintStLaurentClintStLaurent ✭✭✭✭✭ USUniversity ✭✭✭✭✭

    I'll bet it never works right. In the end the placeholder text is a label inside a composite control. And Label has several unresolved bugs with HorizontalTextAlignment

    So until Xamarin fixes the Label bugs, any control that utilities a Label will inherit its problems.

  • JoshSchweigertJoshSchweigert ✭✭ USMember ✭✭

    @ClintStLaurent said:
    I'll bet it never works right. In the end the placeholder text is a label inside a composite control. And Label has several unresolved bugs with HorizontalTextAlignment

    So until Xamarin fixes the Label bugs, any control that utilities a Label will inherit its problems.

    So here's something interesting. On an earlier version of Xamarin I was able to get this exact behavior to work but using stack layouts surrounding the entry. So something may have changed between the latest version of Xamarin in VS 2015 vs the latest in 2017?

Sign In or Register to comment.