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

android自定義鍵盤:空格鍵的觸摸區(qū)域未完全覆蓋

android custom keyboard: touch area of space key not completely covered(android自定義鍵盤:空格鍵的觸摸區(qū)域未完全覆蓋)
本文介紹了android自定義鍵盤:空格鍵的觸摸區(qū)域未完全覆蓋的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我開發(fā)了一個 android 自定義鍵盤,它看起來幾乎就像原來的鍵盤之一.它還有特殊的鍵可以在字母/數(shù)字和班次之間切換.除了SPACE"鍵(底部的大條)之外,所有鍵似乎都可以正常工作.我可以按中間的空格鍵但觸摸左右區(qū)域(大約是空格鍵寬度的 1/3)不被識別為觸摸.

I have developed an android custom keyboard which looks almost like one of the original ones. It has also special keys to switch between letters / numbers and shift. all keys seem to work perfectly except the "SPACE" key (the large bar at the bottom). I am able to hit the space bar in the middle but touches on areas on the right and left (appr. 1/3 of the width of the space bar) are not recognized as touches.

我已經(jīng)嘗試為空格鍵使用另一個鍵碼/圖標(biāo),甚至將空格鍵放在鍵盤的另一行,以查看它是否特定于該鍵或行.但似乎自定義鍵盤上的鍵可以具有一般的最大"寬度......?我也可以在所有布局中重現(xiàn)(縱向/橫向/布局-大...).

I already tried to use another keycode / icon for the space bar or even place the spacebar in another row of the keyboard to see if it is specific to that key or row. But it seems there is a general "maximum"-width a key on a custom keyboards can have...? I'ts also reproducable in all layouts (portrait / landscape / layout-large ...).

下面是我的 keypad.xml 文件來定義我的鍵盤.有誰知道這個問題/限制?

Below is my keypad.xml file to define my keyboard. Does anyone know about this issue / limitation?

<?xml version="1.0" encoding="utf-8"?>
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
   android:keyWidth="35dp"
    android:horizontalGap="3dp"
    android:verticalGap="0.2%p"
    android:keyHeight="9%p">

    <Row  android:keyWidth="9%p" >
        <Key android:codes="113" android:keyLabel="q" android:keyEdgeFlags="left"/>
        <Key android:codes="119" android:keyLabel="w"/>
        <Key android:codes="101" android:keyLabel="e"/>
        <Key android:codes="114" android:keyLabel="r"/>
        <Key android:codes="116" android:keyLabel="t"/>
        <Key android:codes="122" android:keyLabel="z"/>
        <Key android:codes="117" android:keyLabel="u"/>
        <Key android:codes="105" android:keyLabel="i"/>
        <Key android:codes="111" android:keyLabel="o"/>
        <Key android:codes="112" android:keyLabel="p" />

    </Row>

    <Row android:keyWidth="9%p"   >
        <Key android:codes="97" android:keyLabel="a" android:horizontalGap="5%p" 
                android:keyEdgeFlags="left"/>
        <Key android:codes="115" android:keyLabel="s"/>
        <Key android:codes="100" android:keyLabel="d"/>
        <Key android:codes="102" android:keyLabel="f"/>
        <Key android:codes="103" android:keyLabel="g"/>
        <Key android:codes="104" android:keyLabel="h"/>
        <Key android:codes="106" android:keyLabel="j"/>
        <Key android:codes="107" android:keyLabel="k"/>
        <Key android:codes="108" android:keyLabel="l"/>

    </Row>

    <Row android:keyWidth="9%p" >
            <Key android:isSticky="true" android:codes="-2" android:keyLabel="&#9650;" />
        <Key android:codes="121" android:keyLabel="y"/>
        <Key android:codes="120" android:keyLabel="x"/>
        <Key android:codes="99" android:keyLabel="c"/>
        <Key android:codes="118" android:keyLabel="v"/>
        <Key android:codes="98" android:keyLabel="b"/>
        <Key android:codes="110" android:keyLabel="n"/>
        <Key android:codes="109" android:keyLabel="m"/>

      <Key  android:codes="-5" android:keyIcon="@drawable/sym_keyboard_delete" 
                android:keyWidth="19%p" android:keyEdgeFlags="right"
                android:isRepeatable="true" android:horizontalGap="1.5%p"/>




    </Row>
    <Row android:horizontalGap="3dp"
        android:verticalGap="3dp">

        <!-- <Key android:codes="-1" android:keyLabel="&#49;&#50;&#51;" android:keyWidth="10%p"/> -->
        <Key android:codes="-1" android:keyLabel="SYM" android:keyWidth="10%p"/>
         <Key android:codes="32" android:keyIcon="@drawable/sym_keyboard_space"
                android:keyWidth="68%p" android:isRepeatable="true"/>
            <Key android:codes="-11"  android:isRepeatable="true" android:keyIcon="@drawable/sym_keyboard_enter" android:keyWidth="19%p" android:keyEdgeFlags="right"/>

    </Row>

</Keyboard>

推薦答案

問題似乎是來自 Keyboard#getNearestKeys 的方法為寬按鈕返回了正確的值.我通過擴展 Keyboard 類并覆蓋 getNearestKeys 方法解決了這個問題

The problem seems to be that the method from Keyboard#getNearestKeys dosent return proper values for wide buttons. I solved the problem by extending the Keyboard class and overriding the getNearestKeys method

這是我添加的代碼:

@Override
public int[] getNearestKeys(int x, int y) {
    List<Key> keys = getKeys();
    for (int i = 0; i < keys.size(); i++) {
        if (keys.get(i).isInside(x, y)) return new int[]{i};
    }
    return new int[0];
}

這篇關(guān)于android自定義鍵盤:空格鍵的觸摸區(qū)域未完全覆蓋的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

相關(guān)文檔推薦

EditText: Disable Paste/Replace menu pop-up on Text Selection Handler click event(EditText:禁用文本選擇處理程序單擊事件上的粘貼/替換菜單彈出)
Multiline EditText with Done SoftInput Action Label on 2.3(2.3 上帶有完成 SoftInput 操作標(biāo)簽的多行 EditText)
How to detect the swipe left or Right in Android?(如何在 Android 中檢測向左或向右滑動?)
Prevent dialog dismissal on screen rotation in Android(防止在Android中的屏幕旋轉(zhuǎn)對話框解除)
How do I handle ImeOptions#39; done button click?(如何處理 ImeOptions 的完成按鈕點擊?)
How do you set EditText to only accept numeric values in Android?(您如何將 EditText 設(shè)置為僅接受 Android 中的數(shù)值?)
主站蜘蛛池模板: 亚洲美女天堂网 | 成人不卡 | 亚洲精品在线91 | 国内精品久久影院 | 成人av观看 | 欧美日韩福利视频 | 中文字幕第二十页 | 99久久久无码国产精品 | 欧美成人h版在线观看 | 午夜影晥 | 欧美在线激情 | 欧美一区二 | 久久精品二区 | 久久精品日产第一区二区三区 | 不卡在线视频 | 丁香六月激情 | 精品国产高清一区二区三区 | 一二三四在线视频观看社区 | 午夜影院官网 | 日韩精品一区二区三区中文字幕 | 国产伦精品一区二区三区精品视频 | 黄色大片视频 | 午夜精品一区二区三区在线播放 | 国产一区二区三区久久久久久久久 | www312aⅴ欧美在线看 | 麻豆久久久9性大片 | www.99re| 欧美在线视频一区二区 | 国内自拍视频在线观看 | 日本超碰| 91精品国产综合久久久久久蜜臀 | 99热热热热 | 日韩中文视频 | 视频在线亚洲 | 99在线精品视频 | 久久一区二区三区电影 | 一区二区三区在线免费观看 | 午夜免费在线 | 一区二区三区成人 | 综合久久亚洲 | 亚洲国产aⅴ精品一区二区 免费观看av |