Android的 - 如何从disscociate标题栏上的应用程序的名称?应用程序、栏上、名称、标题

2023-09-06 05:03:45 作者:忘川之上#三生之下

我添加了一个自定义标题栏,以一个Android应用程序,这标题栏(这是一个普通的PNG)中显示的主要活动中。问题是,主要的活动也定义了使用标签中的应用程序的名称标签是这样的:

I added a custom title-bar to an android application and this titlebar (which is a plain png) shows up inside the main activity. The problem is that the main activity also defines the name of the application using the label tag like this:

<activity android:name=".MainActivity" 
                  android:theme="@style/customTheme"
                  android:screenOrientation="portrait"
                  android:label="@string/app_name">
              <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
              </intent-filter>
 </activity>

和这个标签还报告了标题栏!如何以解离两个? (基本上一样,依然能够提供一个名称的应用程序,而不会影响我的自定义标题栏)。

And this label is also reported on the titlebar! How to dissociate the two? (Like basically, still be able to give a name to the application without affecting my custom title-bar).

谢谢!

推荐答案

您可以使用的setTitle(标题)更改任何活动的头java的code的页面。如果您想使用在XML文件中定义字符串,则可以使用的setTitle(R.string.stringName)