c# - Android EditText 设置最大长度

标签 c# android xamarin

我试图设置 EditText 的最大长度,但没有成功。

我试过这样的:

a.setFilters (new InputFilter[] { new InputFilter.LengthFilter (a.Length) });

我得到了一些错误(Not at a.Length)。

像这样:

a.setMaxLength ( a.Lenght);

还有一些错误。

我想我忘记了一些标题,但这只是一个猜测。

提到我使用 Xamarin。提前谢谢你。

最佳答案

如果你使用 C# 的话,如果你像这样尝试的话效果最好

MyEditText.SetFilters( new IInputFilter[] { new InputFilterLengthFilter(10) } );

关于c# - Android EditText 设置最大长度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25424646/

相关文章:

c# - 在内存中缓存数据库表

c# "Bad Data"解密时出现异常 - 使用 Base64 编码进行传输

c# - 哪个是 C# 和 .NET 的 "best"数据访问框架/方法?

c# - 如何在 C# (Xamarin) 中使用 setOnTouchListener?

java - 如何更改 Android 选择器中的 DrawableLeft?

C#.net GridView .数据源

java - 等到 firebase 数据检索数据

android - JSESSIONID=0000fWm58im_RcpQXmWI8LlDdvg :-1 what does ":-1" resembles to?

android - ExpandableListView.addHeaderView() 没有保留布局参数

xamarin - 管理 Xamarin 表单中的资源图像