Czego szukasz „klucz podgląd” Zakładam, że używasz KeyboardView
aby utworzyć niestandardową klawiaturę. Można włączyć podgląd klucza dzwoniąc setPreviewEnabled(boolean previewEnabled) powinno być coś takiego: mKeyboardView.setPreviewEnabled(true);
Edit:
myślę, że to link pomoże Ci w realizacji i wyjaśnia bardziej szczegółowo, co starałem się.
Najpierw trzeba utworzyć układ za pomocą klawiatury, zazwyczaj zawiera ona tylko keyboardView:
<?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" />
A potem utworzyć inny układ dla podglądu
<?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>
Po tym można zaprojektować swoją klawiaturę w twoim przypadku coś takiego:
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:keyWidth="10%p"
android:horizontalGap="0px"
android:verticalGap="0px"
android:keyHeight="60dp">
<Row>
<Key android:codes="49" android:keyLabel="1" android:keyEdgeFlags="left"/>
<Key android:codes="50" android:keyLabel="2"/>
<Key android:codes="51" android:keyLabel="3"/>
</Row>
<Row>
<Key android:codes="52" android:keyLabel="4"/>
<Key android:codes="53" android:keyLabel="5"/>
<Key android:codes="54" android:keyLabel="6"/>
</Row>
<Row>
<Key android:codes="55" android:keyLabel="7"/>
<Key android:codes="56" android:keyLabel="8"/>
<Key android:codes="57" android:keyLabel="9"/>
</Row>
</Keyboard>
Wreszcie w twoim java co możesz zawyżać swoją klawiaturęView lub otrzymasz ją według jej identyfikatora, jeśli jest uwzględniona w fragmencie lub układzie działania. i ustawiłeś klawiaturę, którą do niej zaprojektowałeś.
kv = (KeyboardView)getLayoutInflater().inflate(R.layout.keyboard, null);
keyboard = new Keyboard(this, R.xml.numeric);
kv.setKeyboard(keyboard);
kv.setOnKeyboardActionListener(this);
Powodzenia.
piękne pytanie Chcę coś nowego –