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

編輯文本鍵偵聽(tīng)器

Edit Text key listener(編輯文本鍵偵聽(tīng)器)
本文介紹了編輯文本鍵偵聽(tīng)器的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

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

我的布局中有一個(gè) edittext 和一個(gè)按鈕,在我的代碼中我將 edittextkeyListener 設(shè)置為 null

I have an edittext and a button in my layout and in my code I'm setting keyListener of the edittext as null

    editText.setKeyListener(null);

這樣我就無(wú)法輸入我的 edittext.現(xiàn)在點(diǎn)擊我的按鈕,我應(yīng)該能夠輸入我的 ediitext.我怎樣才能做到這一點(diǎn).這是一個(gè)簡(jiǎn)單的問(wèn)題,但我找不到任何解決方案.任何幫助將不勝感激.

so that I cannot type into my edittext. Now on my button click I should be able to type into my ediitext. How can I do that. It's a simple problem, but I'm not able to find any solution. Any help would be much appreciated.

推薦答案

我現(xiàn)在可能遲到了,但是我就是這樣做的:

I'm probably late now but, this is the way I do it:

public class MyActivity extends Activity
{
    private KeyListener listener;
    private EditText editText;

    public void onCreate(...)
    {
        editText = ... // Get EditText from somewhere
        listener = editText.getKeyListener(); // Save the default KeyListener!!!
        editText.setKeyListener(null); // Disable input
    }

    // When you click your button, restore the default KeyListener
    public void buttonClickHandler(...)
    {
        editText.setKeyListener(listener);
    }
}

基本上,在調(diào)用 setKeyListener(null) 之前,首先保存 EditText 的默認(rèn) KeyListener.然后,當(dāng)您單擊按鈕時(shí),再次調(diào)用 setKeyListener,傳遞您之前保存的默認(rèn)偵聽(tīng)器.

Basically, you first save the EditText's default KeyListener before you call setKeyListener(null). Then, when you click your button, you call setKeyListener again, passing the default listener you previously saved.

這篇關(guān)于編輯文本鍵偵聽(tīng)器的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(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)在展開(kāi)的 EditText 中的開(kāi)始位置)
EditText, adjustPan, ScrollView issue in android(android中的EditText,adjustPan,ScrollView問(wèn)題)
主站蜘蛛池模板: 国产91在线播放 | 国产区一区二区三区 | 国产欧美精品区一区二区三区 | 亚洲精品久 | 天天艹天天干天天 | 天天干天天爱天天爽 | 一级毛片视频 | 91视频网址| 一区二区三区亚洲 | 综合激情久久 | 精品欧美激情精品一区 | 日本小视频网站 | 又爽又黄axxx片免费观看 | 国产一区在线免费观看视频 | 欧美精品在欧美一区二区少妇 | 欧美亚洲国产日韩 | 色综合一区 | 亚洲国产一 | 精品久久久久久久久久久 | 人人爽人人爽 | 国产精品久久久久av | 精品国产99| 午夜国产羞羞视频免费网站 | 国产美女在线观看 | 97精品一区二区 | 波多野结衣一区二区 | 97超碰在线播放 | 99热在这里只有精品 | 日韩av在线中文字幕 | 亚洲一区精品在线 | 国产亚洲一区二区三区在线观看 | 成人在线观看黄 | 久久高清| 91在线视频国产 | 亚洲福利 | 国产美女久久久 | 国产精品久久国产精品99 | 日韩欧美一区二区三区免费观看 | 国产欧美一区二区三区在线看 | 在线欧美激情 | 伊人网站在线观看 |