久久久久久久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問題)
主站蜘蛛池模板: 四虎在线播放 | 成人免费毛片片v | 成人免费看片在线观看 | 懂色av一区二区三区 | 免费在线观看黄色片 | 91色漫| 国产日韩在线播放 | 国产精品tv| 欧美a一级| 免费视频一区二区 | 成人午夜影院 | 欧美一区二区三区视频 | 欧美在线中文字幕 | 中文字幕免费高清 | 国产精品自拍小视频 | 国产精品3 | 天天久久综合 | 日本xxxx69 | 麻豆一区二区三区 | 国产激情网 | 免费高清av | 午夜精品久久久久久久99 | 成人高潮片免费 | 亚洲美女网站 | 五月婷视频 | 不卡免费视频 | 国产传媒视频在线观看 | 日日夜夜草 | 丰满少妇高潮无套内谢 | 日产精品久久久一区二区 | 高清一级片 | 欧美日批视频 | 久久精品一区二区三区四区五区 | 97色综合 | 91av免费在线观看 | 在线观看黄色av | 国产成人99久久亚洲综合精品 | 黄视频免费观看 | 精品免费视频 | 国产成人精品三级麻豆 | 国产毛片在线 |