本文介绍了将Xamarin.Android应用迁移到Xamarin.Forms应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我正处于开始Xamarin项目的风口浪尖.我一直在研究最好的起点是什么,我得出的结论是,我需要学习Android框架,并开始在Xamarin中而不是Xamarin.Forms上构建本机Android应用程序.I'm on the cusp of beginning a Xamarin project. I have been doing loads of research on what the best starting point would be and i have come to the conclusion that i need to learn the Android framework and begin by building a native Android app in Xamarin instead of Xamarin.Forms.但是,展望未来,我希望成为此应用程序的跨平台平台.我一直在搜索有关使用Xamarin.Android应用程序并将其迁移到Xamarin.Forms应用程序所需的任何信息,因此我可以为自己的项目构建iOS应用程序.However, looking to the future i would want to be cross platform for this app. I have searched high and low on any information about what it would take to take a Xamarin.Android app and migrate it into a Xamarin.Forms app so that i can then build out the iOS app for my project.任何人都知道此过程是容易还是困难?您可以使用Xamarin.Android应用程序,然后有人将其迁移到Xamarin.Forms项目吗?如果不是,方法是在Xamarin.Forms项目下重建应用程序吗?有一个简单的方法吗?Does anyone have any information on if this process is easy or hard to do? Can you take a Xamarin.Android app and someone migrate it to a Xamarin.Forms project? And if not would the approach be to rebuild the apps under a Xamarin.Forms project? Is there a easy approach to this?对此的任何信息将不胜感激.Any info on this would be greatly appreciated.推荐答案凭借Xamarin(本机和Forms)的两年以上经验,我从未见过可帮助您进行迁移的工具或任何种类的工具,但我可以就此发表您的个人看法,也许可以在这里和那里为您提供一些帮助.让我们开始With more than two years of experience with Xamarin(Native and Forms), I have never seen a tool or anything of any sort that will help you with migration but I can give you my personal opinion on this and maybe help you a little here and there. Lets Begin我会说这是一个不错的决定,因为我的亲身经历告诉我,在开始使用Xamarin Forms之前了解Android或iOS对您至关重要,否则,您有时会迷失方向代码,思考如何使自己陷入混乱;)I would say this was a good decision Since my personal experience tells me that it is crucial for you to know either Android or iOS before you start working with Xamarin Forms otherwise there will be points in time where you will be lost af seeing the code, thinking how did you get yourself into this mess ;)没有直接的方法可以执行此操作,您将不得不使用老式的方法...将(手动)Android XML转换为XAML非常容易,因此设计不会成为问题.C#部分可能是一个问题,因为本机Android代码与表单完全不同,但是您可以轻松地做到这一点.There is no direct way of doing this you will have to do it the old fashioned way...Converting(Manually) Android XML to XAML is quite easy so the design won't be an issue.The C# part might be a problem as a native Android code is quite different to forms, But you can do it with ease with time. 注意:关于Xamarin.Forms的工作原理,您会记住很多东西.因为当您开始进行更改时,您会遇到很多寻找等效项和东西的问题,但会变得更容易这不是困难或容易的事,而是要花时间或不花时间,请相信我,这需要时间.It's not about hard or easy it's about time taking or not and trust me it takes time.问题的这一部分让我有些困惑,但是如果你的意思是可能的话.I am a little bit confused by this part of the question but if you mean is it possible yes it is. 我的评论:您将需要对Xamarin.Forms如何工作有充分的了解,并且我的意思是,您至少应该阅读 Xamarin大学可以在一周左右的时间里完成正确的理解.You will need Good knowledge of how Xamarin.Forms work and by that I mean you should at least go through all the Xamarin.Forms guides in Xamarin University which can be completed in a week or so with proper understanding.展望未来,我想为您的Forms应用程序使用MVVM框架,它将帮助您拥有结构良好的代码,并使您与行业标准保持最新.Going forward I would say use an MVVM framework for your Forms app, it will help you have a well-structured code and will keep you up to date with the industry standard.此外,请注意,对于MVVM的初学者来说, MVVMCross 也是复杂,因此如果您不知道什么是MVVM,请避免使用 Prism 或 FreshMVVM 比较容易.Also, note that MVVMCross for a beginner in MVVM is too complex, so avoid it if you have no idea what MVVM is, going with Prism or FreshMVVM would be comparatively easier. 不要过分依赖Xamarin.FormsNuGet可以完成某些功能.相反,使用插件为所有内容编写自己的代码过于依赖,并且在关键时刻成为问题.Rather write your own code using Plugins for everything is too much dependency and becomes a problem at crucial times.如有任何查询,请随时还原Feel free to revert in case of any queries 这篇关于将Xamarin.Android应用迁移到Xamarin.Forms应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-23 09:12