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

從 onTextChangeListener() 更改 EditText 文本

Change EditText text from onTextChangeListener()(從 onTextChangeListener() 更改 EditText 文本)
本文介紹了從 onTextChangeListener() 更改 EditText 文本的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

我正在開發一個 Android 應用程序.在我的應用程序中,我必須使用基于文本的圖像.所以我為 EditText 編寫 OnChangeListener().以下是我的示例代碼.

I am working on an Android application.In my app I have to use images based on the text.So I write OnChangeListener() for EditText.The following is my sample code.

edt.addTextChangedListener(this);  
@Override
public void afterTextChanged(Editable s) {
    // TODO Auto-generated method stub
    CharSequence cs=convert(edt.getText.toString());
            edt.setText(cs);
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
        int after) {
    // TODO Auto-generated method stub


}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
    // TODO Auto-generated method stub


}

但我收到上述代碼的異常.我知道異常的原因是從 afterTextChanged() 方法調用 setText().但是我必須根據相同的 EditText 文本更改來更改 EditText 文本值.幫助我的朋友

But I am getting Exception for the above code.I know the reason for the exception is calling setText() from afterTextChanged() method. But I have to change the EditText text value based on the same EditText text change.Help me friends

推薦答案

只需在設置文本之前移除您的監聽器,并在完成后重新注冊,如下所述:

Just simply remove your listener before you set the text, and register it again after you are done, like described here:

添加 onTextChanged 實現后清除 EditText 文本

這篇關于從 onTextChangeListener() 更改 EditText 文本的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

Cut, copy, paste in android(在android中剪切、復制、粘貼)
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 位小數的數字)
Changing where cursor starts in an expanded EditText(更改光標在展開的 EditText 中的開始位置)
EditText, adjustPan, ScrollView issue in android(android中的EditText,adjustPan,ScrollView問題)
主站蜘蛛池模板: 国产精品一区二区视频 | 免费一级大片 | 一级黄色小视频 | 欧美性猛交99久久久久99按摩 | 亚洲久久在线 | 国产精品自在线 | 性欧美8khd高清极品 | 国产在线视频网站 | 日日日日干 | 欧美日本在线观看 | 久久久久久久久国产精品 | 午夜视频免费观看 | 日韩免费视频 | 亚洲综合激情网 | 亚洲砖区区免费 | 免费国产精品视频 | 欧美三级又粗又硬 | 亚洲国产欧美在线 | 国产女人18毛片水18精品 | 国产精品美女www爽爽爽 | 国产麻豆一区二区 | 无套内谢的新婚少妇国语播放 | 一级片在线播放 | 中文字幕99 | 四虎影库| 中文字幕婷婷 | 国产区在线 | 午夜视频免费观看 | 91porn在线| 夜夜骑夜夜操 | 精品国产乱码久久久久 | 在线观看免费黄色 | 成人黄性视频 | 91综合网| 国产吃瓜黑料一区二区 | 国产欧美另类 | 四虎看片 | 九色91在线 | 成人一区二区三区 | 欧美激情影院 | 成年人黄色片 |