-1

我的目标是在 .Droid 项目的 xamarin 表单中的自定义控件上设置密码输入。

我的自定义渲染代码:

class MyEntryRendererPassword : EntryRenderer
{
    //CUSTOM entry RENDER PER ANDROID
    protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
    {
        base.OnElementChanged(e);
        if (Control != null)
        {
            Control.SetMaxHeight(150);
            Control.SetTextColor(Android.Graphics.Color.Rgb(255,255,255));
            Control.SetBackgroundColor(Android.Graphics.Color.Rgb(43, 50, 58));
            //Control.SetRawInputType(InputTypes.TextFlagNoSuggestions | InputTypes.TextVariationVisiblePassword);

        }
    }
}

我已经测试了我在网上看到的许多代码,但没有成功。如何设置控制标签,如密码标签?用户写作时我会看到这些点。谢谢。

4

1 回答 1

2

我认为您需要设置InputType属性,例如:

Control.InputType = Android.Text.InputTypes.TextVariationPassword | 
                          Android.Text.InputTypes.ClassText;
于 2017-04-21T09:14:53.310 回答