1
votes

I am newbie to Xamarin development.

In android we have different values folder for multi-device support.

But In Xamarin forms how we give multi-device support for Android & iOS?

Anyone don't know about what is multi-device support pls check the sample document by Android
https://developer.android.com/guide/practices/screens_support.html

I want similar like this for Xamarin forms.

Note: I am asking about Xamarin forms not in native code.

Any suggestions or ideas are welcome. Thanks for your answers.

1
Negative voters need to mention the reason also. - Ranjith Kumar
What's you mean "different values folder for multi-device support"? Different layout file? - Eren Shen
@YorkShen-MSFT are you don't aware of multi-device support in Android? If anybody don't know pls type the "Multi-device support in Android" you will get answer. developer.android.com/guide/practices/screens_support.html - Ranjith Kumar
I understand the multi-device support, in Xamarin.Forms project, Provide different layouts for different screen sizes did not work anymore, since Xamarin.Forms has its own layout in PCL, Provide different bitmap drawables for different screen densities still did work in Xamarin.Android project. - Eren Shen
@YorkShen-MSFT pls read question once again. I am asking about Xamarin forms. I already mentioned in Note: I am asking about Xamarin forms not in native code. No documentation about multi-device support in Xamarin forms. No questions in SO. no one answer for Xamarin questions. Hate Xamarin now - Ranjith Kumar

1 Answers

6
votes

How to give multi-device support in Xamarin Forms

Xamarin.Forms XAML Support :

Xamarin.Forms use the platform-specific mechanisms to calculate the absolute pixel dimensions. As Digitalsa1nt said, Xamarin.Forms uses xaml as it's base markup language for renderng displays, and converts this into the native counterparts at runtime. Usually, you don't have to care about the resolution, it will adjust the views based on your layout and constraints.


Some useful link about Xamarin.Forms multi-device support :


Update :

You could read this official document: Dealing with sizes and the related sample. It demonstrates many solutions to solve your problem :

For example : the Platform-specific font size at no cost

In some cases we need to assign a different font size to controls based on the specific operating system's styles, avoiding hard-coded values. Through the Device class, Xamarin.Forms makes this possible at no cost.

In your Page OnAppearing() method :

protected override void OnAppearing()
{
    base.OnAppearing();
    this.LargeLabel.FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label));
    this.SmallLabel.FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label));
    this.MediumLabel.FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label));
}

Effect :

enter image description here