Xamarin how it is getting the Native Look and Feel?

与世无争的帅哥 提交于 2019-12-20 12:34:16

问题


I am new to Xamarin. I have few confusion here.

Question:

  1. How does Xamarin get the Native Look and Feel of the UI Components?.
  2. Does Xamarin Provide their own Widgets [ like button, Layouts, ..].

Here is my understanding Correct me if I am wrong?.

1) Develop the UI [ button, layout...] by native SDK. For example iOS use Xcode. for Android ?.

2) Consider the button, when the button is pressed, the the code which is going to get executed is common across the platform.

3) So, Since UI are directly from their respective SDK, we get the Native Look and Feel.

Kindly correct me where I misunderstood?.


回答1:


I think you are way off.

Xamarin provides C# and the .Net (Mono) runtime on iOS and Android. At the same time they expose the native APIs on each platform to C#. So they built a way for C# to call into Objective-C and Java (and vice versa).

This means you develop native UIs on each platform, and can share backend business logic between platforms. A Xamarin app can share somewhere between 50-75% of its code across platforms. There is no general sharing of the UI across platforms, since this would abstract away the native APIs.

To break it down:

Android

  • Use Xamarin Studio or Visual Studio to develop your C# backend code
  • Use Xamarin's Android designer to layout native Android XML layouts

iOS

  • Use Xamarin Studio or Visual Studio* to develop your C# backend code
  • Use XCode on a Mac to layout storyboard or XIB files for native iOS UI layout

Both options you can create your UI from code as well, but the native APIs will be different on each platform.

*A mac is needed to compile for iOS



来源:https://stackoverflow.com/questions/15763579/xamarin-how-it-is-getting-the-native-look-and-feel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!