java - Activity android:label 更改应用程序名称
问题描述
我开始了一个没有活动的新项目,然后我创建了自己的项目并将它们注册为如下所示。但是每当我在我的 LoginActivity 上放置一个标签时,它就会改变应用程序名称。
<application
android:name=".app.ApplicationController"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".activities.LoginActivity"
android:label="@string/login_screen_label"
android:launchMode="singleTop"
android:windowSoftInputMode="adjustPan">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".activities.RegisterActivity"
android:launchMode="singleTop"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".activities.MainActivity"
android:launchMode="singleTop"/>
</application>
还有我的字符串资源
<string name="app_name">My ToDo</string>
<string name="login_screen_label">Log in</string>
我究竟做错了什么
更新actitity_login.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="0dp" >
</RelativeLayout>
解决方案
添加标签android:label="app name"
_application
使用android:label
inapplication
标签将设置应用程序名称。并且使用android:label
inActivity
标签将设置Activity
.
推荐阅读
- elasticsearch - 如何在 Windows 中从 ./bin/elasticsearch 运行 elasticsearch 文件
- python - Django - 仅显示特定的 JSON 部分
- android - FragmentManager 正确实例化片段,但内容片段不可见
- c# - 忽略文件“xyz.loadtest”中包含的负载测试,因为它在单元测试资源管理器中不受支持
- azure - 如何使用 Bot Framework 连接逻辑应用程序?
- c# - IDistributedCache:Refresh/RefreshAsync 是否实际刷新缓存值或只是到期时间
- python - Django说Pillow没有安装,即使它是
- python-3.x - 如何根据多个列值按多个分组?
- r - 如何将多列组合在一起并绘制条形图?
- google-apps-script - 打印仅由用户最近创建的所有文件和文件夹