EditText中对于软键盘控制
来源:互联网 发布:js 导出excel插件 编辑:程序博客网 时间:2024/05/17 17:16
在猜数字游戏的开发中,对于EditText设置setEnable()的属性为false时,继续点击EditText继续出现软键盘,输入软件盘的字符,依然可以在EditText显示字符
2.解决方案
在EditText中有一个setInputType()属性,里面参数为int 型。而InputType类中有如下常量:
/**
* Mask of bits that determine the overall class
* of text being given. Currently supported classes are:
* {@link #TYPE_CLASS_TEXT}, {@link #TYPE_CLASS_NUMBER},
* {@link #TYPE_CLASS_PHONE}, {@link #TYPE_CLASS_DATETIME}.
* If the class is not one you
* understand, assume {@link #TYPE_CLASS_TEXT} with NO variation
* or flags.
*/
public static final int TYPE_MASK_CLASS = 15;
/**
* Mask of bits that determine the variation of
* the base content class.
*/
public static final int TYPE_MASK_VARIATION =4080;
/**
* Mask of bits that provide addition bit flags
* of options.
*/
public static final int TYPE_MASK_FLAGS = 16773120;
/**
* Special content type for when no explicit type has been specified.
* This should be interpreted to mean that the target input connection
* is not rich, it can not process and show things like candidate text nor
* retrieve the current text, so the input method will need to run in a
* limited "generate key events" mode.
*/
public static final int TYPE_NULL = 0;
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
/**
* Class for normal text. This class supports the following flags (only
* one of which should be set):
* {@link #TYPE_TEXT_FLAG_CAP_CHARACTERS},
* {@link #TYPE_TEXT_FLAG_CAP_WORDS}, and.
* {@link #TYPE_TEXT_FLAG_CAP_SENTENCES}. It also supports the
* following variations:
* {@link #TYPE_TEXT_VARIATION_NORMAL}, and
* {@link #TYPE_TEXT_VARIATION_URI}. If you do not recognize the
* variation, normal should be assumed.
*/
public static final int TYPE_CLASS_TEXT = 1;
/**
* Flag for {@link #TYPE_CLASS_TEXT}: capitalize all characters. Overrides
* {@link #TYPE_TEXT_FLAG_CAP_WORDS} and
* {@link #TYPE_TEXT_FLAG_CAP_SENTENCES}. This value is explicitly defined
* to be the same as {@link TextUtils#CAP_MODE_CHARACTERS}.
*/
public static final int TYPE_TEXT_FLAG_CAP_CHARACTERS = 4096;
/**
* Flag for {@link #TYPE_CLASS_TEXT}: capitalize first character of
* all words. Overrides {@link #TYPE_TEXT_FLAG_CAP_SENTENCES}. This
* value is explicitly defined
* to be the same as {@link TextUtils#CAP_MODE_WORDS}.
*/
public static final int TYPE_TEXT_FLAG_CAP_WORDS = 8192;
/**
* Flag for {@link #TYPE_CLASS_TEXT}: capitalize first character of
* each sentence. This value is explicitly defined
* to be the same as {@link TextUtils#CAP_MODE_SENTENCES}.
*/
public static final int TYPE_TEXT_FLAG_CAP_SENTENCES = 16384;
/**
* Flag for {@link #TYPE_CLASS_TEXT}: the user is entering free-form
* text that should have auto-correction applied to it.
*/
public static final int TYPE_TEXT_FLAG_AUTO_CORRECT = 32768;
/**
* Flag for {@link #TYPE_CLASS_TEXT}: the text editor is performing
* auto-completion of the text being entered based on its own semantics,
* which it will present to the user as they type. This generally means
* that the input method should not be showing candidates itself, but can
* expect for the editor to supply its own completions/candidates from
* {@link android.view.inputmethod.InputMethodSession#displayCompletions
* InputMethodSession.displayCompletions()} as a result of the editor calling
* {@link android.view.inputmethod.InputMethodManager#displayCompletions
* InputMethodManager.displayCompletions()}.
*/
public static final int TYPE_TEXT_FLAG_AUTO_COMPLETE = 65536;
/**
* Flag for {@link #TYPE_CLASS_TEXT}: multiple lines of text can be
* entered into the field. If this flag is not set, the text field
* will be constrained to a single line.
*/
public static final int TYPE_TEXT_FLAG_MULTI_LINE = 131072;
/**
* Flag for {@link #TYPE_CLASS_TEXT}: the regular text view associated
* with this should not be multi-line, but when a fullscreen input method
* is providing text it should use multiple lines if it can.
*/
public static final int TYPE_TEXT_FLAG_IME_MULTI_LINE = 262144;
/**
* Flag for {@link #TYPE_CLASS_TEXT}: the input method does not need to
* display any dictionary-based candidates. This is useful for text views that
* do not contain words from the language and do not benefit from any
* dictionary-based completions or corrections. It overrides the
* {@link #TYPE_TEXT_FLAG_AUTO_CORRECT} value when set.
*/
public static final int TYPE_TEXT_FLAG_NO_SUGGESTIONS = 0x00080000;
// ----------------------------------------------------------------------
/**
* Default variation of {@link #TYPE_CLASS_TEXT}: plain old normal text.
*/
public static final int TYPE_TEXT_VARIATION_NORMAL = 0;
/**
* Variation of {@link #TYPE_CLASS_TEXT}: entering a URI.
*/
public static final int TYPE_TEXT_VARIATION_URI = 16;
/**
* Variation of {@link #TYPE_CLASS_TEXT}: entering an e-mail address.
*/
public static final int TYPE_TEXT_VARIATION_EMAIL_ADDRESS = 32;
/**
* Variation of {@link #TYPE_CLASS_TEXT}: entering the subject line of
* an e-mail.
*/
public static final int TYPE_TEXT_VARIATION_EMAIL_SUBJECT = 32;
/**
* Variation of {@link #TYPE_CLASS_TEXT}: entering a short, possibly informal
* message such as an instant message or a text message.
*/
public static final int TYPE_TEXT_VARIATION_SHORT_MESSAGE = 64;
/**
* Variation of {@link #TYPE_CLASS_TEXT}: entering the content of a long, possibly
* formal message such as the body of an e-mail.
*/
public static final int TYPE_TEXT_VARIATION_LONG_MESSAGE = 80;
/**
* Variation of {@link #TYPE_CLASS_TEXT}: entering the name of a person.
*/
public static final int TYPE_TEXT_VARIATION_PERSON_NAME = 96;
/**
* Variation of {@link #TYPE_CLASS_TEXT}: entering a postal mailing address.
*/
public static final int TYPE_TEXT_VARIATION_POSTAL_ADDRESS = 112;
/**
* Variation of {@link #TYPE_CLASS_TEXT}: entering a password.
*/
public static final int TYPE_TEXT_VARIATION_PASSWORD = 128;
/**
* Variation of {@link #TYPE_CLASS_TEXT}: entering a password, which should
* be visible to the user.
*/
public static final int TYPE_TEXT_VARIATION_VISIBLE_PASSWORD = 144;
/**
* Variation of {@link #TYPE_CLASS_TEXT}: entering text inside of a web form.
*/
public static final int TYPE_TEXT_VARIATION_WEB_EDIT_TEXT = 160;
/**
* Variation of {@link #TYPE_CLASS_TEXT}: entering text to filter contents
* of a list etc.
*/
public static final int TYPE_TEXT_VARIATION_FILTER = 176;
/**
* Variation of {@link #TYPE_CLASS_TEXT}: entering text for phonetic
* pronunciation, such as a phonetic name field in contacts.
*/
public static final int TYPE_TEXT_VARIATION_PHONETIC = 176;
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
/**
* Class for numeric text. This class supports the following flag:
* {@link #TYPE_NUMBER_FLAG_SIGNED} and
* {@link #TYPE_NUMBER_FLAG_DECIMAL}.
*/
public static final int TYPE_CLASS_NUMBER = 2;
/**
* Flag of {@link #TYPE_CLASS_NUMBER}: the number is signed, allowing
* a positive or negative sign at the start.
*/
public static final int TYPE_NUMBER_FLAG_SIGNED = 4096;
/**
* Flag of {@link #TYPE_CLASS_NUMBER}: the number is decimal, allowing
* a decimal point to provide fractional values.
*/
public static final int TYPE_NUMBER_FLAG_DECIMAL = 8192;
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
/**
* Class for a phone number. This class currently supports no variations
* or flags.
*/
public static final int TYPE_CLASS_PHONE = 3;
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
/**
* Class for dates and times. It supports the
* following variations:
* {@link #TYPE_DATETIME_VARIATION_NORMAL}
* {@link #TYPE_DATETIME_VARIATION_DATE}, and
* {@link #TYPE_DATETIME_VARIATION_TIME},.
*/
public static final int TYPE_CLASS_DATETIME = 4;
/**
* Default variation of {@link #TYPE_CLASS_DATETIME}: allows entering
* both a date and time.
*/
public static final int TYPE_DATETIME_VARIATION_NORMAL = 0;
/**
* Default variation of {@link #TYPE_CLASS_DATETIME}: allows entering
* only a date.
*/
public static final int TYPE_DATETIME_VARIATION_DATE = 16;
/**
* Default variation of {@link #TYPE_CLASS_DATETIME}: allows entering
* only a time.
*/
public static final int TYPE_DATETIME_VARIATION_TIME = 32;
当设置InputType属性为TYPE_DATATIME_VARIATION_NORMAL时,点击EditText时将不会出现软键盘,若在软键盘已经跳出,那么软键盘输入的字符依然不可用。
- EditText中对于软键盘控制
- Android中EditText常用属性与软键盘控制
- android EditText软键盘弹出控制
- EditText光标控制和软键盘隐藏
- android中editText弹出软键盘并且根据editText中是否是内容来控制按钮的可用性
- EditText中如何随心所欲的控制软键盘的展示与隐藏
- Activity中 EditText 隐藏软键盘
- Dialog中EditText 弹出软键盘
- Dialog中EditText不能弹出软键盘
- android scrollview中edittext 软键盘跳出遮住edittext
- EditText 属性大全 及 与软键盘 控制的关联
- 控制EditText自动获取焦点弹出软键盘
- Android控件EditText软键盘的调用和控制
- editText屏蔽软键盘
- edittext 输入法软键盘
- EditText和软键盘
- EditText使用软键盘
- Edittext编辑软键盘
- ExpandableListView简单用法
- ExpandableListView修改group图标
- QQ在线客户服务,网站的联系QQ
- 使用ListView一些小技巧
- Android中播放GIF图片动画
- EditText中对于软键盘控制
- EditText常用设置
- android系统自带样式android:theme属性
- 日期控件DatePicker只显示年月不显示日
- android-生命周期状态
- 如何解决软键盘弹出引起的各种不适
- android 自动在线升级 服务器端为tomcat
- Dialog 处理KeyEvent
- android EditText彻底搞定输入框隐藏/显示背景 可编辑输入问题