How to change android Activity label

前端 未结 10 1676
心在旅途
心在旅途 2021-02-05 02:53

I have created an Activity and declared in Manifest file. But I would like to re-use the same Activity for other purpose.

 

        
相关标签:
10条回答
  • 2021-02-05 03:18

    Use

    setTitle(int titleId)
    

    or

    setTitle(CharSequence title)
    
    0 讨论(0)
  • 2021-02-05 03:19

    Static, not Dynamic

    Go to your AndroidManifest.xml file and add the android:label attribute to the activity tag you want, like this:

    <activity android:name=".name" android:label="label"/>
    
    0 讨论(0)
  • 2021-02-05 03:22
    if(Condition)
    {
        setTitle("Your Title");
    }
    else
    {
        // your Default Title from Manifest
    }
    

    Try to use this line.

    0 讨论(0)
  • 2021-02-05 03:27

    User this

    @Override
      public void onCreate(Bundle savedInstanceState) {
        setTitle("Your Title");
      }
    
    0 讨论(0)
提交回复
热议问题