<EditText
android:id="@+id/myinfoedit_remark_et"
android:layout_width="fill_parent"
android:layout_height="120dp"
android:background="@color/white"
android:gravity="top"
android:hint="我的签名"
android:paddingLeft="15dp"
android:paddingTop="15dp"
android:paddingRight="15dp"
android:textColor="@color/text_222222"
android:textColorHint="@color/text_c4c4c4"
android:textSize="14dp" />
<TextView
android:id="@+id/shufuxianzhi"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:textColor="#016cd9"
android:textSize="12dp" />
mRemark_Et.addTextChangedListener(new TextWatcher()
{//EditView自动判断输入长度
@Override
public void onTextChanged(CharSequence s, int start, int before, int count)
{
// TODO Auto-generated method stub
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after)
{
// TODO Auto-generated method stub
}
@Override
public void afterTextChanged(Editable s)
{
String content = mRemark_Et.getText().toString();
int l = content.length();
mRemarkXianZhi.setText(l + "");//需要将数字转成字符串
if (l > 30)
{
mRemark_Et.setText(content.substring(0, 30));
mRemark_Et.setSelection(30);//EditView设置光标到最后
}
}
});