1 回答

TA貢獻(xiàn)1799條經(jīng)驗(yàn) 獲得超9個(gè)贊
這似乎是一個(gè)永遠(yuǎn)不會(huì)被調(diào)用的現(xiàn)有問(wèn)題CustomRenderer。我們將重點(diǎn)關(guān)注這個(gè)問(wèn)題。
解決方法1:
如果你只是想設(shè)置 的下劃線(xiàn)顏色Entry。無(wú)需設(shè)置Visual=Material,只需創(chuàng)建一個(gè)默認(rèn)的Custom Renderer即可Entry。
if (Control != null)
{
? Control.BorderStyle = UITextBorderStyle.None;
?
? UIView lineView = new UIView()
? {
? ? ?Frame = new CGRect(0, Element.HeightRequest - 1, Element.WidthRequest, 1),
? ? ?BackgroundColor = UIColor.Red,
? };
?
? Control.AddSubview(lineView);
?
}
不要忘記在 xaml 中設(shè)置WidthRequestand HeightRequest。
解決方法2
幸運(yùn)的是,nuget 有很多 Material Controls 插件。并且您可以直接下載并使用。例如MaterialFormControls
從 Nuget Manager 下載軟件包(確保選中包含預(yù)發(fā)布)
并設(shè)置屬性 AccentColor 來(lái)更改下劃線(xiàn)顏色
<local:MaterialEntry?IsPassword="True"?Placeholder="email"?AccentColor="Red"/>
- 1 回答
- 0 關(guān)注
- 147 瀏覽
添加回答
舉報(bào)