Hello,
Welcome to our Microsoft Q&A platform!
How to make adaptive UI for the different screen sizes of devices on XF
To set fontSize for the control based on the screen size, try get the device info and detect the size to specify a value to the fontSize. You could create a custom control to perform the work.
Check the code:
public class CustomLabel : Label
{
public CustomLabel()
{
//using Xamarin.Essentials api to get the info of the current device
var mainDisplayInfo = DeviceDisplay.MainDisplayInfo;
var width = mainDisplayInfo.Width;
var height = mainDisplayInfo.Height;
//specify a value to the fontSize based on the device's size
if (1000 < width && width < 1200)
{
this.FontSize = 20;
}
}
}
Best Regards,
Jarvan Zhang
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.