嘿所有可能会在几次之前询问,但我想将文本设置为动作栏 我使用了以下代码来完成这项工作......但没有帮助..
ActionBar bar = getActionBar();
bar.setTitle(Html.fromHtml("<center>" + "<b>" + "Sign Up" + "</b>"
+ "</center>"));
当我使用时,我的目的是满足任何准确的答案。
答案 0 :(得分:1)
TextView customView = (TextView)LayoutInflater.from(this).inflate(R.layout.actionbar_custom_title_view_centered,null);
ActionBar.LayoutParams params = new ActionBar.LayoutParams(ActionBar.LayoutParams.MATCH_PARENT, ActionBar.LayoutParams.MATCH_PARENT, Gravity.CENTER);
customView.setText("Your centered text");
getSupportActionBar().setCustomView(customView, params);