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

查看:42
本文介绍了如何在 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天全站免登陆