TextView 设置maxLength

  1.xml方式

 <TextView android:id="@+id/tv"

    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"
    android:maxLength="12"/>

2.Java方式
textView.setFilters(new InputFilter[] { new InputFilter.LengthFilter(12) });
posted @ 2017-09-19 13:49  lucktian  阅读(367)  评论(0编辑  收藏  举报