为什么我无法更改应用中每个屏幕的操作栏中的标签?

时间:2014-02-17 18:25:56

标签: android android-actionbar

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

<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>

我已经搜索了一些答案,但似乎没有任何正确的答案。请帮助谢谢!

1 个答案:

答案 0 :(得分:0)

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

setTitle("SetYourTitle Here");

您可以参考此主题获取更多信息:How to change the text on the action bar

相关问题