应用程序基本代码共享 [英] Application base code sharing

查看:72
本文介绍了应用程序基本代码共享的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近在Windows App Studio中创建了一个应用程序,外观非常棒。我想为Android创建相同的版本。有没有办法分享Android平台应用程序的基本代码?

I recently created an app in Windows App Studio, and the look was amazing. I thought about creating the same version for Android. Is there any way to share the base code of the app for the android platform?

推荐答案

Hello Demetriok,

Hello Demetriok,

为了分享Android平台的UWP版本的基本代码,
Xamarin.Forms API可以为您提供一个选项,它可以帮助您完全在C#和XAML中快速构建适用于iOS,Android和Windows的本机应用程序。

For the purpose of sharing base code of your UWP version for Android platform, Xamarin.Forms API could be an option for you, which can help you quickly build native apps for iOS, Android and Windows completely in C# and XAML.

因此,可以有两个选项:

Thus, there can be two options:


  • 如果选择 Xamarin.Forms 方法,可以在Visual Studio中创建一个新的Xamarin.forms项目,您可能需要重写您的项目根据从App Studio下载的UWP源代码。因为接口控件的大多数方法和事件
    与UWP不同,尽管它们继承自UWP。如果代码共享比自定义UI更重要,这种方法更适合您的应用。
  • 您也可以选择 Xamarin.Android ,这样您就可以使用Android平台特定的API和实现自定义UI的机会更多。
  • If you choose Xamarin.Forms approach, you can create a new Xamarin.forms project in Visual Studio and you might need to rewrite your project according to your UWP source code downloaded from App Studio. Because the most method and event of interface controls are different from UWP's, although they inherit from UWP's. This approach is more appropriate for your app if code sharing is more important than custom UI.
  • You can also choose Xamarin.Android, in this way you can use Android platform-specific APIs and there can be more chance to realize custom UI.

这两种方法都允许您使用C#和.NET框架构建具有共享业务逻辑的Android版本。

Both of two ways allow you to build your Android version with shared business logic using C# and the .NET framework.

有关详细信息,您可以按照 文档开始

For more details, you might follow the documentation to get started.

祝你好运,

Mattew Wu

Mattew Wu


这篇关于应用程序基本代码共享的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆