我在用
Window w = getWindow();
w.setTitle("My title");
要更改我当前活动的标题,但似乎不工作。
有人能告诉我怎么改变吗?
我在用
Window w = getWindow();
w.setTitle("My title");
要更改我当前活动的标题,但似乎不工作。
有人能告诉我怎么改变吗?
当前回答
在Kotlin中,这样做:
this.title = resources.getText(R.string.fast_learning)
其他回答
如果你想在Java文件中设置标题,那么写在你的活动onCreate
setTitle("Your Title");
如果你想在Manifest里写
<activity
android:name=".MainActivity"
android:label="Your Title" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
setTitle(getResources().getText(R.string.MyTitle));
在Kotlin中,这样做:
this.title = resources.getText(R.string.fast_learning)
我使用的是Android Studio 3.0.1。
有一个活动:
setTitle("Title Text");
在一个片段内:
getActivity().setTitle("Title Text");
setTitle(“欢迎活动”);