我应该为现有的 Android 应用程序选择 Xamarin native 还是 Xamarin.Forms?
Should I choose Xamarin native or Xamarin.Forms for existing Android app?
我们有一个 android 应用程序,想为跨平台重新创建它。
支持或反对 Xamarin native 和表单的事实是什么?
原生的优势在于,我们可以重用所有 xml 布局,而我们必须在 XAML 或 XIB 中重新创建 iOS 视图?
有什么东西是真正的阻滞剂吗?
Xamarin.Forms is best for:
Apps that require little platform-specific functionality
Apps where code sharing is more important than custom UI
Developers comfortable with XAML
Xamarin.iOS & Xamarin.Android are best for:
Apps with interactions that require native behavior
Apps that use many platform-specific APIs
Apps where custom UI is more important than code sharing
我个人使用 Xamarin.iOS & Xamarin.Android 和 MvvmCross,这样我可以在每个平台上保持对本机 UI 的完全控制,同时最大限度地提高代码重用。
Giorgis 的回答是正确的,但由于您在此处添加了更多限制,所以我的想法是这样的。
我会分析当前的应用程序。有多少代码是可以共享的业务逻辑? UI 的定制化程度如何,它应该看起来更原生还是更相似?未来会有什么变化?如果您打算在 UI 中进行大量更改并且平台应该看起来相似,那么切换到表单可能会更容易。
还要考虑您是否打算为 Windows Phone 开发?如果是,您可能会为第三个平台节省大量时间。
毕竟有一件事我还要记住。在 Xamarin.Forms 中开发并不意味着你不能开发原生的。它只是一个额外的框架。在最坏的情况下,您仍然可以在本地完成所有操作。
我会根据 Giorgi 的回答发表评论,并参考复制的要点:
这是我过去 6 个月的经验总结:
Xamarin.Forms 最适合:
- 不需要特定平台功能的应用程序
- 错了。通过 DI,您可以使用任何您可能想要的设备功能。如果您对此有疑问,请查看 GitHub 上的 XLabs。
- 代码共享比自定义更重要的应用程序 UI
- 真是胡说八道。您可以编写自己的渲染器以您想要的方式表示每个平台的控件。我还为 SideDrawer 等自定义控件编写了更难的渲染器。在 android 中,我在 2 天内完成,iOS 大约 2 周(android 渲染器只是本机控件的包装器)
- 开发人员对 XAML 感到满意
- 嗯是的,任何喜欢方便 UI 开发的人。请注意,xaml 有一个学习曲线(我在开始 WPF 开发时就已经知道了)。但据我所见,它与 android.
没有什么不同
Xamarin.iOS & Xamarin.Android 最适合:
- 具有需要本机行为的交互的应用
- 虽然在本机破解您的解决方案肯定更快,但如果购买好的控件/了解一个好的本机实现并在 C# 中镜像它,您可以相当快地完成,因为 C# 中的 API 非常类似于原生的。
- 使用许多平台特定 API 的应用
- 不确定为什么 Xamarin 对表单进行反广告。到目前为止我没有遇到什么麻烦
- 自定义 UI 比
代码共享
- 可能是正确的,但保持 UI 功能内联也更难,您将需要更多人力。
关于表单的注意事项:
Forms 目前似乎正在稳定下来,我相信微软会尽最大努力将它变成一个可靠的产品(构建问题在过去有时是一场噩梦,但它随着时间的推移变得更好)
与 WPF XAML 相比,Xamarin 的 XAML 开发较少,但非常相似。然而,最近的 nuget 更新以惊人的速度提供了镜像功能。 XAML 您期望和喜欢的绝大多数功能都已提供。
如果您不进行研究,列表性能会很差 (here)。该区域的性能增加了负载。
如果我必须再次做出选择,我仍然会选择表格。虽然有时有些东西看起来有缺陷/不好,但您通常可以通过某种方式找到一个干净的修复程序,同时花费大部分时间实际开发应用程序。 (有时你仍然会发现一些让你皱眉的事情,为什么有些东西没有实现,比如 Margin 属性 是在微软购买 xamarin 之后才实现的)
- 如果您最终需要嵌套列表,请确保查看嵌入式本机控件以实现最佳性能 - 这对于我正在使用的产品至关重要。参见 this
来自 Xamarin 网站(谁比他们更了解?):
Xamarin.Forms 最适合:
数据录入应用
原型和概念验证
不需要特定平台功能的应用程序
代码共享比自定义更重要的应用 UI
[https://developer.xamarin.com/guides/xamarin-forms/]
使用 Xamarin.Forms 在运行时 ,每个页面及其控件都映射到特定于平台的本机用户界面元素。
使用本机 Xamarin.Android 和 Xamarin.iOS 应用程序利用特定于平台的硬件加速,并针对本机性能进行编译。这无法通过在运行时解释代码的解决方案来实现。
"Xamarin.iOS - The best way to build native iOS apps."
- Ship native app bundles on the App Store. Our Ahead-of-Time (AOT) compiler compiles Xamarin.iOS apps directly to native ARM assembly
code, meaning your app is a native platform binary.
- Access any iOS API. We bring 100% of Apple’s iOS SDK to C#, enhancing Objective-C APIs with stronger types and .NET naming
conventions so you feel right at home.
- Call existing Objective-C code from C#. Use your existing Objective-C code, frameworks, and custom controls in your Xamarin app
using our automatic binding generator.
- Build WatchKit apps. Use Xamarin Studio or Visual Studio to build new Watch Apps, edit Watch user interfaces in the iOS Designer, and
debug Watch apps in the iOS Simulator.
- Stay up-to-date with Apple. We released same-day support for iOS 5, iOS 6, iOS 7, and iOS 8 so your apps can take advantage of the
latest iOS features as soon as possible.
[https://www.xamarin.com/platform]
"Xamarin.Android - The best way to build native Android apps."
- Ship native Android packages. Xamarin.Android uses just-in-time compilation for sophisticated runtime optimization of your app’s
performance, meaning your app is a native Android APK.
- Access any Android API, including new form factors. We bring 100% of Google’s Android APIs to C#, enhancing Java APIs with async support
and .NET naming conventions so you feel right at home.
- Call existing Java code from C#. Use your existing Java code, frameworks, and custom controls in your Xamarin app using our
automatic binding generator.
- Build Android Wear apps. With access to 100% API support for Android Wear, create full-featured applications capable of running on
Android Wear devices. Stay up-to-date with Android. Xamarin stays
up-to-date with the most current APIs from Google, so you can always
use the latest features in your apps.
我们有一个 android 应用程序,想为跨平台重新创建它。
支持或反对 Xamarin native 和表单的事实是什么?
原生的优势在于,我们可以重用所有 xml 布局,而我们必须在 XAML 或 XIB 中重新创建 iOS 视图?
有什么东西是真正的阻滞剂吗?
Xamarin.Forms is best for:
Apps that require little platform-specific functionality Apps where code sharing is more important than custom UI Developers comfortable with XAML
Xamarin.iOS & Xamarin.Android are best for:
Apps with interactions that require native behavior Apps that use many platform-specific APIs Apps where custom UI is more important than code sharing
我个人使用 Xamarin.iOS & Xamarin.Android 和 MvvmCross,这样我可以在每个平台上保持对本机 UI 的完全控制,同时最大限度地提高代码重用。
Giorgis 的回答是正确的,但由于您在此处添加了更多限制,所以我的想法是这样的。
我会分析当前的应用程序。有多少代码是可以共享的业务逻辑? UI 的定制化程度如何,它应该看起来更原生还是更相似?未来会有什么变化?如果您打算在 UI 中进行大量更改并且平台应该看起来相似,那么切换到表单可能会更容易。
还要考虑您是否打算为 Windows Phone 开发?如果是,您可能会为第三个平台节省大量时间。
毕竟有一件事我还要记住。在 Xamarin.Forms 中开发并不意味着你不能开发原生的。它只是一个额外的框架。在最坏的情况下,您仍然可以在本地完成所有操作。
我会根据 Giorgi 的回答发表评论,并参考复制的要点:
这是我过去 6 个月的经验总结:
Xamarin.Forms 最适合:
- 不需要特定平台功能的应用程序
- 错了。通过 DI,您可以使用任何您可能想要的设备功能。如果您对此有疑问,请查看 GitHub 上的 XLabs。
- 代码共享比自定义更重要的应用程序 UI
- 真是胡说八道。您可以编写自己的渲染器以您想要的方式表示每个平台的控件。我还为 SideDrawer 等自定义控件编写了更难的渲染器。在 android 中,我在 2 天内完成,iOS 大约 2 周(android 渲染器只是本机控件的包装器)
- 开发人员对 XAML 感到满意
- 嗯是的,任何喜欢方便 UI 开发的人。请注意,xaml 有一个学习曲线(我在开始 WPF 开发时就已经知道了)。但据我所见,它与 android. 没有什么不同
Xamarin.iOS & Xamarin.Android 最适合:
- 具有需要本机行为的交互的应用
- 虽然在本机破解您的解决方案肯定更快,但如果购买好的控件/了解一个好的本机实现并在 C# 中镜像它,您可以相当快地完成,因为 C# 中的 API 非常类似于原生的。
- 使用许多平台特定 API 的应用
- 不确定为什么 Xamarin 对表单进行反广告。到目前为止我没有遇到什么麻烦
- 自定义 UI 比
代码共享
- 可能是正确的,但保持 UI 功能内联也更难,您将需要更多人力。
关于表单的注意事项:
Forms 目前似乎正在稳定下来,我相信微软会尽最大努力将它变成一个可靠的产品(构建问题在过去有时是一场噩梦,但它随着时间的推移变得更好)
与 WPF XAML 相比,Xamarin 的 XAML 开发较少,但非常相似。然而,最近的 nuget 更新以惊人的速度提供了镜像功能。 XAML 您期望和喜欢的绝大多数功能都已提供。
如果您不进行研究,列表性能会很差 (here)。该区域的性能增加了负载。
如果我必须再次做出选择,我仍然会选择表格。虽然有时有些东西看起来有缺陷/不好,但您通常可以通过某种方式找到一个干净的修复程序,同时花费大部分时间实际开发应用程序。 (有时你仍然会发现一些让你皱眉的事情,为什么有些东西没有实现,比如 Margin 属性 是在微软购买 xamarin 之后才实现的)
- 如果您最终需要嵌套列表,请确保查看嵌入式本机控件以实现最佳性能 - 这对于我正在使用的产品至关重要。参见 this
来自 Xamarin 网站(谁比他们更了解?):
Xamarin.Forms 最适合: 数据录入应用 原型和概念验证 不需要特定平台功能的应用程序 代码共享比自定义更重要的应用 UI
[https://developer.xamarin.com/guides/xamarin-forms/]
使用 Xamarin.Forms 在运行时 ,每个页面及其控件都映射到特定于平台的本机用户界面元素。 使用本机 Xamarin.Android 和 Xamarin.iOS 应用程序利用特定于平台的硬件加速,并针对本机性能进行编译。这无法通过在运行时解释代码的解决方案来实现。
"Xamarin.iOS - The best way to build native iOS apps."
- Ship native app bundles on the App Store. Our Ahead-of-Time (AOT) compiler compiles Xamarin.iOS apps directly to native ARM assembly code, meaning your app is a native platform binary.
- Access any iOS API. We bring 100% of Apple’s iOS SDK to C#, enhancing Objective-C APIs with stronger types and .NET naming conventions so you feel right at home.
- Call existing Objective-C code from C#. Use your existing Objective-C code, frameworks, and custom controls in your Xamarin app using our automatic binding generator.
- Build WatchKit apps. Use Xamarin Studio or Visual Studio to build new Watch Apps, edit Watch user interfaces in the iOS Designer, and debug Watch apps in the iOS Simulator.
- Stay up-to-date with Apple. We released same-day support for iOS 5, iOS 6, iOS 7, and iOS 8 so your apps can take advantage of the latest iOS features as soon as possible.
[https://www.xamarin.com/platform]
"Xamarin.Android - The best way to build native Android apps."
- Ship native Android packages. Xamarin.Android uses just-in-time compilation for sophisticated runtime optimization of your app’s performance, meaning your app is a native Android APK.
- Access any Android API, including new form factors. We bring 100% of Google’s Android APIs to C#, enhancing Java APIs with async support and .NET naming conventions so you feel right at home.
- Call existing Java code from C#. Use your existing Java code, frameworks, and custom controls in your Xamarin app using our automatic binding generator.
- Build Android Wear apps. With access to 100% API support for Android Wear, create full-featured applications capable of running on Android Wear devices. Stay up-to-date with Android. Xamarin stays up-to-date with the most current APIs from Google, so you can always use the latest features in your apps.