2015-10-06 145 views
1

我已經創建了自定義鍵盤,一切正常,除了彈出字符,當我長按鍵盤上的按鍵時不顯示。 你知道修復它嗎,這樣彈出的字符將作爲一個選項出現,用戶可以選擇它們嗎?Android鍵盤彈出字符不顯示

<Keyboard ...> 
    <Row> 
     <Key android:codes="46" android:keyLabel="." android:popupCharacters=","/> 
    </Row> 
</Keyboard> 

這是我按下鍵盤上的按鍵時的樣子。彈出式字符「,」未顯示。

View of the keyboard in action

我的預覽佈局: preview.xml

<?xml version="1.0" encoding="utf-8"?> 
<TextView xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="30dp" 
     android:layout_height="40dp" 
     android:gravity="center" 
     android:background="@drawable/round_preview" 
     android:textStyle="bold" 
     android:textSize="20sp" 
     android:textColor="@color/colorPrimaryDark"/> 

感謝。

回答

2

好吧,我想通了,是什麼問題:

你需要包括一個populLayout

性格popupCharacter:

<Key android:codes="46,63,33" android:keyLabel="." android:keyWidth="10%p" android:popupCharacters=",?!" android:popupKeyboard="@xml/popup_symbols" /> 

和popup_symbols.xml佈局:

<?xml version="1.0" encoding="utf-8"?> 
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android" 
     android:keyWidth="10%p" 
     android:horizontalGap="0px" 
     android:verticalGap="0px" 
     android:keyHeight="40dp" > 
</Keyboard>