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) });