1 import android.text.method.ReplacementTransformationMethod;
2 /**
3 * @author cloud
4 *
5 */
6 public class AllCapTransformationMethod extends ReplacementTransformationMethod {
7 @Override
8 protected char[] getOriginal() {
9 char[] aa= { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z' };
10 return aa;
11 }
12 @Override
13 protected char[] getReplacement() {
14 char[] AA= { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z' };
15 return AA;
16 }
17 }
18 //将需要转换的edittext实现该方法
19 editext.setTransformationMethod(new AllCapTransformationMethod ());