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

如何设置输入的EditText字母自动大写

2013-09-07 
怎么设置输入的EditText字母自动大写怎么设置输入的EditText字母自动大写[解决办法]package com.gainko.he

怎么设置输入的EditText字母自动大写
怎么设置输入的EditText字母自动大写
[解决办法]
package com.gainko.helper;

import android.text.method.ReplacementTransformationMethod;

/**
 * @author bruce.z
 * 
 */
public class AllCapTransformationMethod extends ReplacementTransformationMethod {

@Override
protected char[] getOriginal() {
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' };
return aa;
}

@Override
protected char[] getReplacement() {
char[] cc = { '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' };
return cc;
}

}

///
editext.setTransformationMethod(new AllCapTransformationMethod ());

热点排行