2017-02-22 1 views

答えて

0

カスタムキーボードの上部にのTextViewを追加する方法:

Create a Custom Keyboard on Android

ファイルを作成という名前のres /レイアウト/キーボード.xmlの内容を次のように置き換えます。

<?xml version="1.0" encoding="UTF-8"?> 
<android.inputmethodservice.KeyboardView 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/keyboard" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    android:keyPreviewLayout ="@layout/preview" 
/> 

keyPreviewLayoutは、キーボード上のキーが押されるたびに表示される短命ポップアップのレイアウトです。それは単一のTextViewを含んでいます。解像度/レイアウト/ preview.xmlという名前のファイルを作成し、そこに次の行を追加します。

<?xml version="1.0" encoding="utf-8"?> 
<TextView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:gravity="center" 
    android:background="#ffff00" 
    android:textStyle="bold" 
    android:textSize="30sp" 
    >  
</TextView> 
+0

は、お返事ありがとうございましたが、私はすでに私がテキストの提案を示し、キーボードの上のTextViewを追加する必要があり、今これを行って... –

関連する問題