shaghayegh mahmoudi
shaghayegh mahmoudi

Reputation: 13

Xamarin Forms Frame in Android

I have four frames, I want to enter in that number. When running on Windows, the numbers are fully visible, but when I run on Android, numbers are not visible or half appear. I do not want to change outlines so that they get out of shape And change their appearance I'm beginner in xamarin Please advise me to display the numbers correctly while running on Android without changing the appearance of my frames.

XAML:

    <Style TargetType="Frame" >
        <Setter Property="BackgroundColor" Value="White"/>
        <Setter Property="CornerRadius" Value="15"/>
        <Setter Property="HeightRequest" Value="30"/>
        <Setter Property="BorderColor" Value="Blue"/>
        <Setter Property="Margin" Value="3"/>
    </Style>

</ContentPage.Resources>
<StackLayout BackgroundColor="White" Orientation="Vertical" >

    <Image Source="d.png"  WidthRequest="60" HeightRequest="60" Margin="0,5,0,5"/>

    <BoxView WidthRequest="40" HeightRequest="60" BackgroundColor="Pink" HorizontalOptions="Center"/>

    <Label Text="کد ارسال شده را اینجا وارد کنید" TextColor="Black" FontSize="15" HorizontalOptions="Center" Margin="0,5,0,0"
           VerticalOptions="Center"/>


    <StackLayout  Orientation="Horizontal" HorizontalOptions="Center" Spacing="10"  BackgroundColor="White">

        <Frame WidthRequest="80" x:Name="frame1"  >
            <Entry Keyboard="Numeric" TextColor="Black"  FontSize="20" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" MaxLength="1"
                   HorizontalTextAlignment="Center" Focused="Entry_Focused" Unfocused="Entry_unFocused" />

        </Frame>

        <Frame WidthRequest="80"  x:Name="frame2" >
            <Entry Keyboard="Numeric" TextColor="Black" FontSize="20" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"
                   HorizontalTextAlignment="Center" MaxLength="1"  Focused="Entry_Focused1" Unfocused="Entry_unFocused1" />

        </Frame>

        <Frame WidthRequest="80" x:Name="frame3" >
            <Entry Keyboard="Numeric" TextColor="Black" FontSize="20" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"
                   HorizontalTextAlignment="Center" Focused="Entry_Focused2" Unfocused="Entry_unFocused2" MaxLength="1" />

        </Frame>

        <Frame WidthRequest="80" x:Name="frame4"
             >
            <Entry Keyboard="Numeric" FontSize="20" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"
               MaxLength="1"    HorizontalTextAlignment="Center" Focused="Entry_Focused3" Unfocused="Entry_unFocused3" />

        </Frame>

    </StackLayout>

    <Button   x:Name="Button"    Text="تایید"  TextColor="White" BackgroundColor="Green" HorizontalOptions="Center"
            VerticalOptions="End" WidthRequest="340" HeightRequest="50" CornerRadius="5" Margin="0,10,0,10"/>

</StackLayout>

Upvotes: 1

Views: 724

Answers (1)

Leon Lu
Leon Lu

Reputation: 9234

You can set the specific heightrequest for android in the Frame

Here is running screenshot in android.

enter image description here

Here is code.

 <Frame  x:Name="frame1" WidthRequest="80" >
            <Entry Keyboard="Numeric" TextColor="Black"  FontSize="20" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" MaxLength="1"
               HorizontalTextAlignment="Center" Focused="Entry_Focused" Unfocused="Entry_Unfocused" >


            </Entry>
            <Frame.HeightRequest>
                <OnPlatform Android="50" ></OnPlatform>


            </Frame.HeightRequest>

        </Frame>

Upvotes: 0

Related Questions