更改活动标题的文本颜色 [英] Change the text color of the activity title
本文介绍了更改活动标题的文本颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Xamarin中,如何更改 ActionBar
?
In Xamarin, how can I change the text colour of the text in the ActionBar
?
中文本的文字颜色
这是我的代码:
ColorDrawable colorDrawable = new ColorDrawable(Color.White);
ActionBar.SetBackgroundDrawable(colorDrawable);
this.TitleColor = Color.Black;
我在 ActionBar
对象,并指定 this.TitleColor
无法正常工作。
I cannot see a correct method in the ActionBar
object, and specifying this.TitleColor
does not work correctly.
推荐答案
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屋!
查看全文