繁体   English   中英

EditText - 在键入时从EditText获取文本

[英]EditText - Get text from EditText while typing

我想在我的应用程序中将文本放入我的应用程序中的一些字符串,同时用户在EditText中键入并使用它在活动上生动地显示它(在不同的视图中...) - 就像谷歌的实时/即时搜索工作...

您正在寻找TextWatcher

    youredittext.addTextChangedListener(new TextWatcher()
    {
        @Override
        public void afterTextChanged(Editable mEdit) 
        {
            text = mEdit.toString();
        }

        public void beforeTextChanged(CharSequence s, int start, int count, int after){}

        public void onTextChanged(CharSequence s, int start, int before, int count){}
    });

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM