Yarh
Yarh

Reputation: 4617

Is it possible to wrap default android keyboard

I am trying to implement extension to keyboard (input method).
I wonder if there is a defualt keyboard resourses/implementation which I can wrap. Eg if user presses 'Default kbd' block 'qwerty' is shown as default android keyboard, and i i press 'my extension' block qwerty replace with extension. note: I looking for the way (if exists) to create custom input method without rebuilnd defualt keyboard, not the app only keyboard cover like this https://github.com/chiragjain/Emoticons-Keyboard

enter image description here

Upvotes: 2

Views: 200

Answers (3)

Fay007
Fay007

Reputation: 2927

You have to create your own custom keyboard to display such scenario. On your keyboard you can maintain two different layer at a time. So all you would need is KeyboardView class:

<android.inputmethodservice.KeyboardView
    android:id="@+id/keyboardView"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    android:focusable="true"
    android:focusableInTouchMode="true"
    android:visibility="gone"
    android:keyBackground="@color/background_color"
    android:keyTextColor="#37474F"
    android:keyTextSize="20sp"
    android:fontFamily="sans-serif"
    android:background="#ECEFF1"/>

Resources to follow:

https://code.tutsplus.com/tutorials/create-a-custom-keyboard-on-android--cms-22615

http://www.fampennings.nl/maarten/android/09keyboard/index.htm

Though these examples would display example only on key representation you can easily add any xml as a keyboard layer.

Upvotes: 0

Denis Gladkiy
Denis Gladkiy

Reputation: 2174

You can try the next trick:

  1. Detect the moment of the keyboard being shown.
  2. Evaluate the bottom of your layout.
  3. Show your UI just above the keyboard.
  4. Hide your UI on the moment of keyboard hiding.

"2" and "3" are slightly different depending on the keyboard showing mode (adjustResiz or adjustPan).

Usefull links:

Upvotes: 0

Jonas K&#246;ritz
Jonas K&#246;ritz

Reputation: 2644

What you're trying to do unfortunately is not possible.

Try to find an open source keyboard implementation and build upon it. See this GitHub repository for a working implementation of the default LatinIME, use it as your base.

Upvotes: 3

Related Questions