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

如何知道 EditText 中的按鍵

How to know key presses in EditText(如何知道 EditText 中的按鍵)
本文介紹了如何知道 EditText 中的按鍵的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問題描述

限時(shí)送ChatGPT賬號(hào)..

我需要檢測(cè) EditText 中軟鍵盤或硬鍵盤上的每個(gè)按鍵.我只需要在按下字符時(shí)一次發(fā)送一個(gè)字符,不需要最終的文本字符串.

I need to detect every key press on either a soft or hard keyboard in EditText. I just need to send the characters one at a time as they are pressed and don't need the final text string.

我曾嘗試將 EditTextonKeyPress 一起使用,但我在這里遇到了問題,即無(wú)法使用軟鍵盤和 TextWatcher 進(jìn)行按鍵操作不是一個(gè)好的選擇,因?yàn)槲倚枰總€(gè)按鍵.是否有任何解決方案可以知道所有按鍵(包括返回、移位、回車...也)?

I have tried using an EditText with onKeyPress, but I ran into the problems here with not getting key presses with soft keyboards and TextWatcher isn't a good option because I need each key press. Is there any solution to know all the keypresses (including back, shift, enter... also)?

推薦答案

如果你有一個(gè)EditText,那么你可以使用TextWatcher接口.在我的代碼中,search_edit 是一個(gè) EditText.

If you have an EditText, then you can use the TextWatcher interface. In my code, search_edit is an EditText.

search_edit.addTextChangedListener(new TextWatcher() {          
    @Override
    public void onTextChanged(CharSequence s, int start, int before, int count) {                                   
        //here is your code
        myadapter.getFilter().filter(s);
        listview.setAdapter(myadapter); 
    }                       
    @Override
    public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        // TODO Auto-generated method stub                          
    }                       
    @Override
    public void afterTextChanged(Editable s) {
        // TODO Auto-generated method stub                  
    }
});

這篇關(guān)于如何知道 EditText 中的按鍵的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

相關(guān)文檔推薦

Cut, copy, paste in android(在android中剪切、復(fù)制、粘貼)
android EditText blends into background(android EditText 融入背景)
Change Line Color of EditText - Android(更改 EditText 的線條顏色 - Android)
EditText showing numbers with 2 decimals at all times(EditText 始終顯示帶 2 位小數(shù)的數(shù)字)
Changing where cursor starts in an expanded EditText(更改光標(biāo)在展開的 EditText 中的開始位置)
EditText, adjustPan, ScrollView issue in android(android中的EditText,adjustPan,ScrollView問題)
主站蜘蛛池模板: 中文字幕一区二区三区在线观看 | 国产伦精品一区二区三区四区视频 | 毛片毛片毛片毛片毛片 | 在线激情视频 | 一区二区三区在线免费观看 | 国产精品久久精品 | 欧美一级欧美一级在线播放 | 男女羞羞免费网站 | 亚洲第一成人av | 亚洲一区二区三区在线播放 | 国产一区二区三区四区五区加勒比 | 一区二区成人 | 久久噜噜噜精品国产亚洲综合 | 91精品国产色综合久久不卡98口 | 免费看91 | 免费视频一区二区 | 国产黄色电影 | 国产婷婷精品 | 91影院在线观看 | 久久久久久久久久久久久九 | 日韩一区二区三区四区五区 | www国产精品| 欧美 日韩 中文 | 1204国产成人精品视频 | 亚洲欧洲中文日韩 | 日韩视频免费在线 | 亚洲久在线 | 国产精品永久 | 午夜电影网 | 中文字幕视频在线观看 | 日韩精品在线观看免费 | av黄色在线观看 | 在线成人精品视频 | 精品国产精品国产偷麻豆 | com.色.www在线观看 | 亚洲精品综合一区二区 | 特级毛片 | 最新超碰 | 精品亚洲一区二区三区四区五区 | 国产精品视频在 | 欧美一区视频在线 |