久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

為 EditText 實(shí)現(xiàn)文本觀察器

Implementing Text Watcher for EditText(為 EditText 實(shí)現(xiàn)文本觀察器)
本文介紹了為 EditText 實(shí)現(xiàn)文本觀察器的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我有一個(gè) EditText.當(dāng)我點(diǎn)擊它時(shí),它變得可聚焦.我將鍵入要輸入到 EditText 中的輸入文本.我想為 EditText 實(shí)現(xiàn)一個(gè)監(jiān)聽器,這樣當(dāng)我停止輸入時(shí),它應(yīng)該自動(dòng)將該文本保存到數(shù)據(jù)庫中,而不是有一個(gè)按鈕.如何讓 EditText 的監(jiān)聽器來監(jiān)聽輸入是否停止?

I have an EditText. When i click on it, it becomes focusable. I will type the input text to be entered into the EditText. I want to implement a listener for EditText, so that when i stop typing, it should automatically save that text into the database instead of having a button. How to have a listener for EditText to listen that typing is stopped or not?

推薦答案

set edittext imeOption

set edittext imeOption

editText.setImeOptions(EditorInfo.IME_ACTION_DONE);

通過使用這樣的東西,

editText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
    @Override
    public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
        if (actionId == EditorInfo.IME_ACTION_DONE) {
            // Specify your database function here.
            return true;
        }
        return false;
    }
});

或者,您可以使用 OnEditorActionListener 接口來避免匿名內(nèi)部類.

Alternatively, you can use the OnEditorActionListener interface to avoid the anonymous inner class.

這篇關(guān)于為 EditText 實(shí)現(xiàn)文本觀察器的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

EditText: Disable Paste/Replace menu pop-up on Text Selection Handler click event(EditText:禁用文本選擇處理程序單擊事件上的粘貼/替換菜單彈出)
Multiline EditText with Done SoftInput Action Label on 2.3(2.3 上帶有完成 SoftInput 操作標(biāo)簽的多行 EditText)
How to detect the swipe left or Right in Android?(如何在 Android 中檢測(cè)向左或向右滑動(dòng)?)
Prevent dialog dismissal on screen rotation in Android(防止在Android中的屏幕旋轉(zhuǎn)對(duì)話框解除)
How do I handle ImeOptions#39; done button click?(如何處理 ImeOptions 的完成按鈕點(diǎn)擊?)
How do you set EditText to only accept numeric values in Android?(您如何將 EditText 設(shè)置為僅接受 Android 中的數(shù)值?)
主站蜘蛛池模板: 日韩毛片视频 | 中文av在线播放 | 欧美精品在线播放 | 日韩视频精品在线 | 亚洲欧美日韩在线 | 欧美精品三区 | 三级成人在线观看 | 天天操天天干天天爽 | 午夜国产一级片 | 精品视频成人 | 亚洲一区二区在线播放 | 玖玖视频网| 欧美日韩不卡 | 日本视频一区二区三区 | 国产亚洲欧美在线 | 久久久无码精品亚洲日韩按摩 | 欧美激情视频一区二区三区在线播放 | 精品成人一区 | 久久精品97 | 久久精品中文 | 精品久久久久久久久久久久久 | 精品视频99| 在线免费观看a级片 | 欧美成人第一页 | 一区二区三区四区日韩 | 成人欧美一区二区三区在线播放 | 黄色在线观看国产 | 亚洲精品一区二区三区在线 | 国产精品永久免费视频 | 日韩高清电影 | 日韩精品视频网 | 久久久久久久久久久爱 | 日本精品一区二区在线观看 | 成人av电影在线 | a黄毛片 | 国产一卡二卡三卡 | 一区二区三区在线播放视频 | 中文字幕精品一区 | 婷婷激情在线 | 男人天堂视频在线观看 | 国产中文字幕亚洲 |