首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

Android中TextView输入字数统计跟限制

2012-08-01 
Android中TextView输入字数统计和限制  ??????????????? selectionStart content.getSelectionStart() 

Android中TextView输入字数统计和限制
  ??????????????? selectionStart = content.getSelectionStart();
  ??????????????? selectionEnd = content.getSelectionEnd();
  ????????????????if (temp.length() > num) {
  ??????????????????? s.delete(selectionStart - 1, selectionEnd);
  ??????????????????? int tempSelection = selectionEnd;
  ??????????????????? content.setText(s);
  ??????????????????? content.setSelection(tempSelection);//设置光标在最后
  ??????????????? }
  ??????????? }
  ???});

热点排行