आप देख रहे हैं क्या मैं आप अपने कस्टम कुंजीपटल बनाने के लिए KeyboardView
उपयोग कर रहे हैं मान है "कुंजी पूर्वावलोकन" । आप इसे ऐसा ही कुछ किया जाना चाहिए setPreviewEnabled(boolean previewEnabled) फोन करके कुंजी पूर्वावलोकन सक्षम कर सकते हैं: mKeyboardView.setPreviewEnabled(true);
संपादित करें:
मुझे लगता है कि इस link अपने कार्यान्वयन में मदद मिलेगी और विवरण मैं करने के लिए क्या प्रयास कर रहा था में अधिक बताते हैं।
सबसे पहले आप कुंजीपटल के लिए एक लेआउट बनाने के लिए, आम तौर पर यह केवल एक 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" />
और फिर आप पूर्वावलोकन के लिए एक और लेआउट बनाने के लिए:
<?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>
उसके बाद आप अपने कीबोर्ड डिजाइन आपके मामले में ऐसा कुछ:
<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>
अंततः आपके जावा सह में यदि आप अपने कीबोर्ड दृश्य को फुलाते हैं या आप इसे अपने आईडी से प्राप्त करते हैं तो यह एक खंड या गतिविधि लेआउट में शामिल है। और आपने कीबोर्ड को सेट किया है जिसे आपने डिज़ाइन किया था।
kv = (KeyboardView)getLayoutInflater().inflate(R.layout.keyboard, null);
keyboard = new Keyboard(this, R.xml.numeric);
kv.setKeyboard(keyboard);
kv.setOnKeyboardActionListener(this);
शुभकामनाएँ।
प्यारा सवाल मैं कुछ नया –