简体   繁体   中英

how can i change the PlaceHolder Text color in xamarin?

im trying to change the PlaceHolder text color of Entry

in android its working fine with EntryRenderer i used the code:

Control.SetHintTextColor(global::Android.Graphics.Color.White);

how can i do the same in ios?

If is a Xamarin Forms Application , there is a easy way to set PlaceHolder Color for iOS and Android :

<Label Text="Hello, Custom Renderer!" />
<local:MyEntry Placeholder="input code" PlaceholderColor="Red"/

The effect :

在此处输入图片说明

By the way , if need to implement it in Render for iOS , here is the solution :

var text = new NSAttributedString("Hello, World", foregroundColor: UIColor.Red);
Control.AttributedPlaceholder = text;

You can set AttributedPlaceholder for UITextField to set color .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM