Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/182.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 为什么可以';我是否更改应用程序中每个屏幕的操作栏标签?_Android_Android Actionbar - Fatal编程技术网

Android 为什么可以';我是否更改应用程序中每个屏幕的操作栏标签?

Android 为什么可以';我是否更改应用程序中每个屏幕的操作栏标签?,android,android-actionbar,Android,Android Actionbar,我的两个活动的操作栏没有标签。我希望主屏幕上有应用程序名称,下一个屏幕上有不同的标签。这是我的清单文件: <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:theme="@style/MSTheme" > <activity android:name="com.andro

我的两个活动的操作栏没有标签。我希望主屏幕上有应用程序名称,下一个屏幕上有不同的标签。这是我的清单文件:

<application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:theme="@style/MSTheme" >

        <activity
            android:name="com.android.recipme.MainScreen"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="com.android.recipme.MyRecipes"
            android:label="@string/my_recipes" >
        </activity>
    </application>


我已经寻找了一些答案,但似乎什么都没有找到。请帮忙,谢谢

要更改所需活动的标题,包括以下行,您应该想更改,通常onCreate()是您想放置此内容的地方:

setTitle("SetYourTitle Here");

您可以参考此线程了解更多信息:

在xml中没有这样做的方法?当您说“我拥有的两个活动的操作栏没有标签”时,这是否意味着操作栏(标题出现的位置)没有显示?是的,这是正确的。它只是空白,但如果我将android:label=“@string/app_name”放在应用程序下,它会添加标签。问题是,它会将app_名称添加到所有屏幕,我希望这两个屏幕有不同的标签。希望这是有道理的。谢谢。您可以尝试删除行android:theme=“@style/MSTheme”,看看这是否有帮助。否则,我会将android:label=“@string/app_name”放在应用程序下,使标题栏出现,然后在所需的活动中调用setTitle(“SetYourTitle Here”)。