【问题标题】:Change the text color of the activity title更改活动标题的文本颜色
【发布时间】:2014-06-02 07:27:45
【问题描述】:

在 Xamarin 中,如何更改 ActionBar 中文本的文本颜色?

我已经成功更改了背景颜色,但没有更改文本颜色。

这是我的代码:

ColorDrawable colorDrawable = new ColorDrawable(Color.White);
ActionBar.SetBackgroundDrawable(colorDrawable); 
this.TitleColor = Color.Black;

我在ActionBar 对象中看不到正确的方法,并且指定this.TitleColor 无法正常工作。

【问题讨论】:

标签: android colors android-actionbar xamarin titlebar


【解决方案1】:

你试过了吗?

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);
    }
}

更多信息this Site

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-07-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多