Resolution-dependent font size in Xamarin

后端 未结 1 1436
孤街浪徒
孤街浪徒 2021-01-17 17:04

I am new with Xamarin and struggling with my first application. I have an image with an entry view above it. This way I create a custom entry background.

The font si

1条回答
  •  借酒劲吻你
    2021-01-17 17:25

    I assume you are using Xamarin.Android rather than Xamarin Forms - you should not need to dyamically change the font size in code. Instead specify the fontSize in either a style or in the control itself and use 'sp' rather than px or dp (For example android:fontSize='16sp'.

    Using 'sp' (scaled pixels) will scale appropriately depending on the user's device dpi (you can see a more indepth explaination here.

    0 讨论(0)
提交回复
热议问题