EditText

作者: Alan龙马 | 来源:发表于2019-11-07 11:58 被阅读0次

EditText用法总结
https://www.jianshu.com/p/bb7667294816
Android EditText 实现软键盘搜索按钮
https://www.jianshu.com/p/ac8f81d73f70
Android edittext 属性inputtype详解
https://www.jianshu.com/p/4e238eb1deb2

EditText的setOnEditorActionListener方法
Android EditText自动获取焦点并弹出软键盘 FM中有效
一行代码解决addTextChangedListener多次重复执行的问题
https://blog.csdn.net/Jiang_Rong_Tao/article/details/90482602


et_pwd.setSelection(et_pwd.getText().length());//EditText将光标移动到最后
android:inputType="textPassword"  //不可见
android:inputType="number" //键盘样色(数字) numberDecimal(小数点的数字)text(小写字母)
android:background="@null"  //去掉EditText中的底部横线
android:gravity="top"//设置文本位置,如设置成“center”,文本将居中显示
android:focusable="false"  EditText设置可以编辑和不可编辑状态
android:digits="0123456789xyzXYZ"  允许输入类型

动态监听输入框变化

edit_content.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {

            }

            @Override
            public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {

            }

            @Override
            public void afterTextChanged(Editable editable) {
                //s  输入结束呈现在输入框中的信息
                LogHelper.e(editable.toString());

            }
        });



etSearch.setOnEditorActionListener(new EditText.OnEditorActionListener() {

            @Override
            public boolean onEditorAction(TextView v, int actionId,
                                          KeyEvent event) {
                if ((actionId == EditorInfo.IME_NULL || actionId == EditorInfo.IME_ACTION_SEARCH) && event != null) {
                    
                    getUserList();
                }
                return false;
            }
        });

相关文章

网友评论

      本文标题:EditText

      本文链接:https://www.haomeiwen.com/subject/utombctx.html