更改活动标题的文本颜色 [英] Change the text color of the activity title
本文介绍了更改活动标题的文本颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Xamarin,我怎么可以改变文本的文本颜色的动作条
?
In Xamarin, how can I change the text colour of the text in the ActionBar
?
我已经改变背景颜色成功,而不是文本的颜色。
I have changed the background colour successfully, but not the text colour.
下面是我的code:
ColorDrawable colorDrawable = new ColorDrawable(Color.White);
ActionBar.SetBackgroundDrawable(colorDrawable);
this.TitleColor = Color.Black;
我看不到在动作条
对象正确的方法,并指定 this.TitleColor
工作不正常。
I cannot see a correct method in the ActionBar
object, and specifying this.TitleColor
does not work correctly.
我可以请有一些帮助呢?
May I please have some help with this?
在此先感谢
推荐答案
你试试这个?
int actionBarTitleId = Resources.getSystem().getIdentifier("action_bar_title", "id", "android");
if (actionBarTitleId > 0) {
TextView title = (TextView) findViewById(actionBarTitleId);
if (title != null) {
title.setTextColor(Color.RED);
}
}
在本网站
这篇关于更改活动标题的文本颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文