EditText当手机输入小写字母时自动转为大写

package org.crazyit.ui;

import android.app.Activity;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.os.Bundle;
import android.os.Handler;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.MotionEvent;
import android.view.View;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TableLayout;

/**
 * Description: 
* site: crazyit.org
* Copyright (C), 2001-2014, Yeeku.H.Lee
* This program is protected by copyright laws.
* Program Name:
* Date: * * @author Yeeku.H.Lee [email protected] * @version 1.0 */ public class InputUITest extends Activity { private EditText edt01; private TableLayout table01; private LinearLayout line01; private String str; // 创建一个Handler对象 Handler handler = new Handler(); // 将要执行的操作写在线程对象的run方法当中(匿名内部类) Runnable UpperCase = new Runnable() { @Override public void run() { System.out.println("UpdateThread"); // 小写转大写 edt01.setText(str.toUpperCase()); // 设置EditText光标位置 edt01.setSelection(str.length()); } }; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); table01 = (TableLayout) findViewById(R.id.table01); // line01 = (LinearLayout) findViewById(R.id.line01); final TheCircle draw = new TheCircle(this); // 设置自定义组件的最大宽度、高度 draw.setMinimumWidth(300); draw.setMinimumHeight(500); table01.addView(draw); edt01 = (EditText) findViewById(R.id.edt01); edt01.addTextChangedListener(new TextWatcher() { public void onTextChanged(CharSequence text, int start, int before, int count) { str = edt01.getText().toString(); // 判断输入的

你可能感兴趣的:(View)