如何在Xamarin.Forms中更改Android应用程序名称? [英] How to change Android application name in Xamarin.Forms?

查看:634
本文介绍了如何在Xamarin.Forms中更改Android应用程序名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Visual Studio For Mac中使用Xamarin.Forms,并且已经创建了一个非常基本的Xamarin.Forms应用程序.

I am working with Xamarin.Forms in Visual Studio For Mac and I have created a very basic Xamarin.Forms application.

我已经检查了Android和iOS目标.我有3个项目:

I have checked Android and iOS targets. I got 3 projects:

  • 一个共同的项目
  • iOS专用项目
  • 还有一个Droid专用项目.

特定于Android的应用程序的应用程序名称后缀为".Droid".

The Android specific application has a ".Droid" suffix in application name.

因此,我决定右键单击droid项目,并在程序集名称"字段中删除此后缀.

So I decided to right click on droid project, and to remove this suffix in "Assembly name" field.

在运行应用程序时(启动时)出现异常.如果我再次更改程序集名称以放置droid后缀,它将不再起作用.

I got an exception where I run the app (at startup). If I change Assembly name again to put the droid suffix, it does not work anymore.

您可以在具有最新版本Xamarin.Forms的空白项目中进行尝试.

You can try this with a blank project with the latest version of Xamarin.Forms.

我不明白为什么?

推荐答案

问题是您正在更改应用程序的程序集名称,而不是名称.

The problem is that you are changing the assembly name of your application, not the name.

如果要在Xamarin.Forms Android中更改应用程序名称,则有两个选项:

If you want to change the application name in Xamarin.Forms Android you have two options:

  • 转到您的MainActivity并更改Label属性:
  • Go to your MainActivity and change the Label property:

  • 或删除MainActivityLabel并通过UI或代码在Manifest.xml中添加名称:
  • Or remove the Label of the MainActivity and add the name in the Manifest.xml via UI or code:

在iOS上,您必须在Info.plist中进行更改.

On iOS you must change it in Info.plist.

这篇关于如何在Xamarin.Forms中更改Android应用程序名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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