How can we make responsive font size in Xamarin forms like this in bootstrap?
If it is a smaller device, show small font,
if it is a larger device, then show large font size.
Is there any NuGet package or work source for that?
You don't need any package for this. The functionality is built-in deep into Xamarin.Forms.
According to the Xamarin's documentation for the Font sizes:
The size value is measured in device-independent units. For more information, see Units of measurement
If you open the Units of measurement link, you will see that:
Xamarin.Forms uses a platform-independent unit of measurement that normalizes units across devices and platforms. There are 160 units per inch, or 64 units per centimeter, in Xamarin.Forms.
Also, if you look through the already predefined Named font sizes, you will see that there are some differences for each built-in size. This is exactly what is happening under the hood - Xamarin is "scaling" the font size accordingly, taking into account the device's dimensions.
You don't need any NuGet package for this. If you want to set different sizes for phones and tabs you can do this.
<Label Text = "Hello"
FontSize = "{OnIdiom Phone = 20 Tablet = 72}" />
Xamarin scales the font size as the unit is device-independent.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With