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

    <bdo id='7CA01'></bdo><ul id='7CA01'></ul>

    <legend id='7CA01'><style id='7CA01'><dir id='7CA01'><q id='7CA01'></q></dir></style></legend>
    1. <tfoot id='7CA01'></tfoot>

      <small id='7CA01'></small><noframes id='7CA01'>

      <i id='7CA01'><tr id='7CA01'><dt id='7CA01'><q id='7CA01'><span id='7CA01'><b id='7CA01'><form id='7CA01'><ins id='7CA01'></ins><ul id='7CA01'></ul><sub id='7CA01'></sub></form><legend id='7CA01'></legend><bdo id='7CA01'><pre id='7CA01'><center id='7CA01'></center></pre></bdo></b><th id='7CA01'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='7CA01'><tfoot id='7CA01'></tfoot><dl id='7CA01'><fieldset id='7CA01'></fieldset></dl></div>
    2. Android:如何通過示例獲取任何 KeyPress 事件?

      Android:how to get any KeyPress event with example?(Android:如何通過示例獲取任何 KeyPress 事件?)
    3. <legend id='bW8ut'><style id='bW8ut'><dir id='bW8ut'><q id='bW8ut'></q></dir></style></legend>
        <bdo id='bW8ut'></bdo><ul id='bW8ut'></ul>

        <tfoot id='bW8ut'></tfoot>

        1. <i id='bW8ut'><tr id='bW8ut'><dt id='bW8ut'><q id='bW8ut'><span id='bW8ut'><b id='bW8ut'><form id='bW8ut'><ins id='bW8ut'></ins><ul id='bW8ut'></ul><sub id='bW8ut'></sub></form><legend id='bW8ut'></legend><bdo id='bW8ut'><pre id='bW8ut'><center id='bW8ut'></center></pre></bdo></b><th id='bW8ut'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='bW8ut'><tfoot id='bW8ut'></tfoot><dl id='bW8ut'><fieldset id='bW8ut'></fieldset></dl></div>

            <small id='bW8ut'></small><noframes id='bW8ut'>

                  <tbody id='bW8ut'></tbody>
                本文介紹了Android:如何通過示例獲取任何 KeyPress 事件?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                我想在用戶按下任意鍵時獲取鍵值,并根據在 android 中按下的鍵執行操作.

                i want to get the key value when user pressed any key and also perform action based on the key pressed in android.

                例如如果用戶按下A"鍵,那么我想得到那個值,比較,做點什么.

                e.g. if user pressed 'A' key then i want to get that value,compare,do something.

                推薦答案

                這個問題的答案應該是雙重的.它由生成密鑰的方式決定.如果它是按下硬件鍵,那么下面描述的兩種方法都是有效的.如果是按軟鍵,則視實際情況而定.

                Answer to this question should be twofold. It is determined by the way how the key was generated. If it was press on the hardware key, then both approaches described below are valid. If it was press on the software key, then it depends on actual context.

                1.) 如果按鍵是通過長按菜單鍵獲得的軟鍵盤按下的結果:

                1.) If key was result of the pressing on the soft keyboard that was obtained by long press on the Menu key:

                您需要小心地重寫以下函數:

                You need to carefully override the following function:

                @Override 
                public boolean onKeyDown(int keyCode, KeyEvent event) {
                
                    switch (keyCode) {
                        case KeyEvent.KEYCODE_A:
                        {
                            //your Action code
                            return true;
                        }
                    }
                    return super.onKeyDown(keyCode, event);
                }
                

                2.) 如果您的活動包含 EditText,并且從中獲得了軟鍵盤,則第一種方法不起作用,因為 EditText 已經使用了鍵事件.您需要使用文本更改的偵聽器:

                2.) If your activity contains EditText, and softkeyboard was obtained from it, then first approach does not work because key event was already consumed by EditText. You need to use text changed Listener:

                mMyEditText.addTextChangedListener(new TextWatcher()
                {
                    public void afterTextChanged(Editable s) 
                    {
                    }
                    public void beforeTextChanged(CharSequence s, int start, int count, int after) 
                    {
                        /*This method is called to notify you that, within s, the count characters beginning at start are about to be replaced by new text with length after. It is an error to attempt to make changes to s from this callback.*/ 
                    }
                    public void onTextChanged(CharSequence s, int start, int before, int count) 
                    {
                    }
                );
                

                這篇關于Android:如何通過示例獲取任何 KeyPress 事件?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                相關文檔推薦

                Get user#39;s current location using GPS(使用 GPS 獲取用戶的當前位置)
                IllegalArgumentException thrown by requestLocationUpdate()(requestLocationUpdate() 拋出的 IllegalArgumentException)
                How reliable is LocationManager#39;s getLastKnownLocation and how often is it updated?(LocationManager 的 getLastKnownLocation 有多可靠,多久更新一次?)
                How to detect Location Provider ? GPS or Network Provider(如何檢測位置提供者?GPS 或網絡提供商)
                Get current location during app launch(在應用啟動期間獲取當前位置)
                locationManager.getLastKnownLocation() return null(locationManager.getLastKnownLocation() 返回 null)
                • <bdo id='PxxOI'></bdo><ul id='PxxOI'></ul>
                  <legend id='PxxOI'><style id='PxxOI'><dir id='PxxOI'><q id='PxxOI'></q></dir></style></legend>

                  <small id='PxxOI'></small><noframes id='PxxOI'>

                      <tbody id='PxxOI'></tbody>
                    <i id='PxxOI'><tr id='PxxOI'><dt id='PxxOI'><q id='PxxOI'><span id='PxxOI'><b id='PxxOI'><form id='PxxOI'><ins id='PxxOI'></ins><ul id='PxxOI'></ul><sub id='PxxOI'></sub></form><legend id='PxxOI'></legend><bdo id='PxxOI'><pre id='PxxOI'><center id='PxxOI'></center></pre></bdo></b><th id='PxxOI'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='PxxOI'><tfoot id='PxxOI'></tfoot><dl id='PxxOI'><fieldset id='PxxOI'></fieldset></dl></div>

                        1. <tfoot id='PxxOI'></tfoot>
                          主站蜘蛛池模板: 99pao成人国产永久免费视频 | 精品国产青草久久久久福利 | 精品欧美一区二区中文字幕视频 | 精品国产一区二区三区久久久久久 | 欧美日韩手机在线观看 | 毛片韩国 | 精品日韩 | 日韩精品一区二区久久 | 91久久国产综合久久 | 91在线精品秘密一区二区 | 中文字幕精品视频 | 91视频国产精品 | 国产高清精品在线 | 亚洲精品一区二区网址 | 国产成人精品免高潮在线观看 | 国产在线精品一区二区三区 | 成人a视频在线观看 | 欧美综合国产精品久久丁香 | 91久久久久久久久久久 | 久久精品国产一区二区三区不卡 | 狠狠操电影| www.国产91 | 日本小电影在线 | 久草视频观看 | 免费的一级视频 | 亚洲电影第三页 | 国产一级大片 | 国产精品国产精品国产专区不片 | 精品国产第一区二区三区 | 中文字幕一级毛片 | 91视视频在线观看入口直接观看 | 中文日韩在线 | 亚洲免费大片 | 中文字幕国产高清 | 亚洲国产成人在线视频 | 久久久久久亚洲 | 欧美日产国产成人免费图片 | 亚洲高清一区二区三区 | 九色国产 | 国产精品久久久久久吹潮 | 亚洲精品电影在线 |