【问题标题】:How do I change the text colour of an Entry Element from Black to White如何将条目元素的文本颜色从黑色更改为白色
【发布时间】:2013-12-07 12:36:53
【问题描述】:

我有一个自定义条目元素类,但我想将文本字段颜色从默认更改为白色。请注意,这不是 TextLabel 文本颜色,而是用户在 EntryElement 中输入的文本。这就是我目前所拥有的......

public class StandardEntryElement : EntryElement
{
    public StandardEntryElement (string caption, string placeholder, string value): base(caption,placeholder,value)
    {
    }

    public StandardEntryElement (string caption, string placeholder, string value, bool isPassword) : base(caption,placeholder,value,isPassword)
    {
    }

    public override UITableViewCell GetCell (UITableView tv)
    {
        var theCell =  base.GetCell (tv);
        theCell.BackgroundColor = Resources.CellBackground;
        theCell.TextLabel.TextColor = Resources.LabelTextColor;
        theCell.TextLabel.Text = Caption;
        return theCell;
    }
}

【问题讨论】:

    标签: xamarin.ios monotouch.dialog


    【解决方案1】:

    你不能 AFAIK,你需要访问私有的“入口”属性,这是实际的 UITextField。

    我最终提取了源代码并更改了这个小花絮。是的,我知道我应该回报我,但那时我的预算是实时的,正确的方法是拥有一个包装器属性,与 UITextAlignment 等相同。

    【讨论】:

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