Sean's Note
2015年6月18日 星期四
Set maximal text length of EditText
In XML:
android:maxLength="20"
In Code:
// EditText 並沒有直接提供 setMaxLength() 這類的方法,所以只能透過 setFilters 來達成
int maxLength = 20;
editText.setFilters(new InputFilter[] {new InputFilter.LengthFilter(maxLength)});
沒有留言:
張貼留言
‹
›
首頁
查看網路版
沒有留言:
張貼留言