updateconfiguration deprecated

TaliAvrahamTaliAvraham USMember ✭✭

I don't want devices with different font size affect the application,
When I tried using: UpdateConfiguration and set the config to default
I get updateconfiguration deprecated: resources.UpdateConfiguration - deprecated
I want the application to look the same on all devices, what should I do

Answers

  • JohnHardmanJohnHardman GBUniversity mod

    @TaliAvraham said:
    I don't want devices with different font size affect the application,
    I want the application to look the same on all devices, what should I do

    Which fonts are you using on each platform? Unless you are using a custom font, you are probably using different fonts on each platform. That's normal. As to "what should I do", the simple answer is assume the fonts will differ, and have your UI cope with the differences. If that's really not appropriate for some reason, deploy a custom font to all target platforms.

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    Are you saying you're trying to tell the user's phone to go back to default regardless what they set it to?

    I want the application to look the same on all devices, what should I do

    Handle it. Everyone has to. You need to set the sizes of your fonts explicitly. But in the end you don't have absolute control of someone else's device. If the user has set the magnification to 150% at the OS level there is nothing you can do about that. They know they did that. They have to accept any unexpected results of their actions.

    I set sizes as resources, then use those resources in my styles. Same with colors etc.

                <!--#region Small-->
                <OnPlatform
                    x:Key="FontSizeSmall"
                    x:TypeArguments="x:Double">
                    <On
                        Platform="iOS"
                        Value="16.0" />
                    <On
                        Platform="Android"
                        Value="12.0" />
                    <On
                        Platform="UWP"
                        Value="16.0" />
                </OnPlatform>
                <!--#endregion Small-->
    
    
                <!--#region ColumnHead-->
                <OnPlatform
                    x:Key="FontSizeColumnHead"
                    x:TypeArguments="x:Double">
                    <On
                        Platform="iOS"
                        Value="24.0" />
                    <On
                        Platform="Android"
                        Value="18.0" />
                    <On
                        Platform="UWP"
                        Value="18.0" />
                </OnPlatform>
                <!--#endregion ColumnHead-->
    
                <Style
                    x:Key="LabelStyleMed"
                    TargetType="Label">
                    <Setter Property="TextColor" Value="{StaticResource PrimaryTextColor}" />
                    <Setter Property="BackgroundColor" Value="{StaticResource SecondaryTextColor}" />
                    <Setter Property="FontSize" Value="{StaticResource FontSizeMedium}" />
                    <Setter Property="VerticalOptions" Value="Center" />
                    <Setter Property="HorizontalOptions" Value="CenterAndExpand" />
                    <Setter Property="VerticalTextAlignment" Value="Center" />
                    <Setter Property="HorizontalTextAlignment" Value="Center" />
                </Style>
    
  • TaliAvrahamTaliAvraham USMember ✭✭
    edited June 2018

    think of a calculator many squares one near the other, and some lines of them, and if the fonts too big I have scroll,
    I need it to fit the size of the device,
    for example if you take the calculator application, in all devices it looks the same there is no scroll

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    Yes. I understand the why. All apps face the same issue because any app can have a Label run off the expected space allotted for it.
    That's why you set the size of the display in your style. So you set the size in that case to 12 or 14 or whatever.

Sign In or Register to comment.