如何设置字符的最大数量为Android的一个EditText?如何设置、字符、数量、最大

2023-09-05 06:00:19 作者:奈奈子

你设置的字符的最大数量是Android的EditText输入怎么办。我看到setMaxLines,setMaxEMS,但没有对字符数。

How do you set the max number of characters for an Android EditText input. I see setMaxLines, setMaxEMS, but nothing for number of characters.

推荐答案

在XML,你可以添加此行到的EditText 查看,其中140个字符的最大数目:

In XML you can add this line to the EditText View where 140 is the maximum number of characters:

android:maxLength="140"