Android Studio重命名项目

时间:2017-03-01 18:30:56

标签: android android-studio

当开始这个项目时,我并没有多想这个名字。现在我想称之为不同的东西,有人能指出我正确的方向。

2 个答案:

答案 0 :(得分:1)

如上所述here,Android Manifest链接到名为strings.xml的{​​{1}}中的变量。

您应该编辑app_name变量,而不是在清单中替换它,因为您可以在应用程序的其他位置使用app_name,而不必在任何地方替换它。

因此,您的app_name应该看起来像这样(除了其他添加的变量之外):

strings.xml

只需将<resources> <string name="app_name">Name here</string> [other values] </resources> 编辑为您想要调用应用的内容,然后重新安装该应用即可。您现在将看到新名称。

注意:在清单中编辑app_name而不是app_name - 行也会更新您在其上使用过的每个引用。引用/链接到android:label文件变量strings.xml的标题中的名称也会在您编辑时更新。更改清单中的行并对其进行硬编码也会起作用,尽管更改strings.xml变量更好

第二个注释:

这不会更改Android Studio中显示的包名称或项目名称。这些也可以更改,但它对设备显示的内容没有影响。即使Android Studio显示正在编辑项目“RandomProjectName”,显示的应用程序名称也可以是“NameRandomProject”。它们没有联系在一起。

答案 1 :(得分:0)

这很简单,转到AndroidManifest.xml并更改android:label值。见下文,

 <application
    android:name=".Application"
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    **android:label="@string/app_name"**
    android:supportsRtl="true"
    android:theme="@style/AppTheme">