找到你要的答案

Q:Editing name of the activity in XML file

Q:在xml文件中编辑活动的名称

The Android Activities name is to be changed. In which XML file can I find the attribute. I didn't find it in Activities corresponding XML file. Thank you.

Android活动名称将被更改。在哪个XML文件中我可以找到属性。我在活动中找不到对应的xml文件。谢谢您.

answer1: 回答1:

When You are adding an Activity in Androidmanifest.xml file you can set android:label="@string/app_name_main" for every activity.. For every activity you can set this.

For eg:

           <activity
            android:name="com.example.FirstActivity"
            android:label="@string/app_name"
            android:theme="@android:style/Theme.Translucent.NoTitleBar" />

            <activity
            android:name="com.example.SecondActivity"
            android:label="@string/app_name2"
            android:theme="@android:style/Theme.Translucent.NoTitleBar" />

            <activity
            android:name="com.example.ThirdActivity"
             android:label="@string/app_name3"
            android:theme="@android:style/Theme.Translucent.NoTitleBar" />

When You are adding an Activity in Androidmanifest.xml file you can set android:label="@string/app_name_main" for every activity.. For every activity you can set this.

例如:

           <activity
            android:name="com.example.FirstActivity"
            android:label="@string/app_name"
            android:theme="@android:style/Theme.Translucent.NoTitleBar" />

            <activity
            android:name="com.example.SecondActivity"
            android:label="@string/app_name2"
            android:theme="@android:style/Theme.Translucent.NoTitleBar" />

            <activity
            android:name="com.example.ThirdActivity"
             android:label="@string/app_name3"
            android:theme="@android:style/Theme.Translucent.NoTitleBar" />
answer2: 回答2:

I think what you search for is:

setTitle("new name")

我想你寻找的是:

setTitle("new name")
answer3: 回答3:

You can change the action bar title which looks like application label using below code.

getSupportActionBar().setTitle("Your title");

Each activity must extends ActionBarActivity/AppBarActivity/FragmentActivity to achieve this.

可以使用下面的代码更改使用应用程序标签的操作栏标题。

getSupportActionBar().setTitle("Your title");

每个活动必须延伸actionbaractivity / appbaractivity / fragmentactivity实现这。

answer4: 回答4:

I think you are asking for changing application label, which is not possible .Because it is a fixed string in the AndroidManifest.xml file which cannot be changed at run-time.

If you are looking for Activity title change, you can set the title of activity by calling 'setTitle("your_title")' in your Activity

我想你要改变应用的标签,这是不可能的。因为它是在AndroidManifest.xml文件不能固定的字符串将在运行时改变。

如果你正在寻找活动名称的变化,你可以通过调用“settitle套活动标题(“your_title”)在你的活动

android  android-activity  android-applicationinfo