C# 安卓密码入口单元

C# 安卓密码入口单元,c#,xamarin,xamarin.forms,xamarin.android,C#,Xamarin,Xamarin.forms,Xamarin.android,我正在开发一个Xamarin.Forms PCL应用程序,现在我正在添加一个设置页面和一个需要密码字段,但由于EntryCells不支持isPassword,我决定添加一个自定义渲染器 我对iOS版本进行了编码,工作正常,但Android版本没有启动 我的渲染器是 [assembly: ExportRenderer(typeof(PasswordEntryCell), typeof(PasswordEntryCellAndroid))] namespace SocialNetwork.Droid

我正在开发一个Xamarin.Forms PCL应用程序,现在我正在添加一个设置页面和一个需要密码字段,但由于EntryCells不支持isPassword,我决定添加一个自定义渲染器

我对iOS版本进行了编码,工作正常,但Android版本没有启动

我的渲染器是

[assembly: ExportRenderer(typeof(PasswordEntryCell), typeof(PasswordEntryCellAndroid))]
namespace SocialNetwork.Droid.Renderers
{
public class PasswordEntryCellAndroid : EntryCellRenderer
{
    protected override Android.Views.View GetCellCore(Cell item, Android.Views.View convertView, ViewGroup parent, Context context)
    {
        var cell = base.GetCellCore(item, convertView, parent, context) as EntryCellView;

        if (cell != null)
        {
            var textField = cell.EditText as TextView;
            textField.InputType = global::Android.Text.InputTypes.TextVariationPassword;
        }

        return cell;
    }
}
}

对于
Android.Widget.EditText
设置
InputType
TransformationMethod

var textField = FindViewById<EditText>(Resource.Id.textView1);
textField.InputType = global::Android.Text.InputTypes.TextVariationPassword;
textField.TransformationMethod = new Android.Text.Method.PasswordTransformationMethod();
var textField = cell.EditText as EditText; // TextView;