在操作栏中编辑文本 [英] Editing text in action bar
本文介绍了在操作栏中编辑文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用的操作栏夏洛克创建用户界面我的应用程序。在添加依赖于我的项目,这样的来回我创建了一个活动来测试它。
I am using Action Bar Sherlock to create the UI for my app. Upon adding the dependencies to my project and such forth I created an activity to test it out.
public class PPS extends SherlockActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getSupportMenuInflater();
inflater.inflate(R.menu.activity_main, menu);
return true;
}
}
我试图改变操作栏但是我不知道如何做到这一点的称号。 当我检查了activity_main这就是我看到的,没有元素来改变活动中的文本。
I am trying to change the title of action bar however I am not sure on how to do this. When I checked the activity_main thats all I saw, no element to change the text in the activity.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
那么,你如何更改操作栏上的文字?
So how do you change the text in the action bar?
推荐答案
在OnCreate():
In the onCreate():
this.getActionBar().setTitle("your title here");
这篇关于在操作栏中编辑文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文