软键盘的屏蔽,点击输入框,不弹出软键盘

package com.zzl.dialog;

import android.text.InputType;
import android.text.method.NumberKeyListener;

/**
* 键盘控制
* @author zzl
*
*/
public class MNumberKeyListener extends NumberKeyListener{
@Override
protected char[] getAcceptedChars() {
// TODO Auto-generated method stub
char [] numberChars = {'0','1','2','3','4','5','6','7','8','9'};
return numberChars;
}

@Override
public int getInputType() {
// TODO Auto-generated method stub
//return InputType.TYPE_NUMBER_FLAG_DECIMAL;
return InputType.TYPE_DATETIME_VARIATION_NORMAL;
}

}


程序中这样调用:
EditText et = (EditText) DialogView.findViewById(R.id.newbox_et_dialog_madeno);

//设置不弹出软键盘,且只能输入数字
et.setKeyListener(new MNumberKeyListener());

你可能感兴趣的:(android)