I am working on an android keyboard app which should show drawing canvas as instead of normal key based soft keyboard. Just like Google's Handwriting keyboard I don't want to implement candidate view or do handwriting recognition. My keyboard will just take the text in canvas and send it as an image.
However after researching a lot, I am still not able to show canvas view in stead of Keyboard view. I followed:
https://code.tutsplus.com/tutorials/create-a-custom-keyboard-on-android--cms-22615
But this adds a keyboard view with a keyboard. I don't want to have a numeric or character keyboard. I just want the keyboard to show an empty canvas where I can draw and once done it should send that image.
I have also tried to put in a layout like this:
<?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:keyBackground="@drawable/square_rounded"
android:background="#ffffff">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="@+id/mainLinearLayout">
<RelativeLayout
android:id="@+id/keyboardLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:layout_width="100dp"
android:layout_height="50dp"
android:text="Cancel"
android:layout_alignParentLeft="true">
</Button>
<Button
android:layout_width="100dp"
android:layout_height="50dp"
android:text="Done"
android:layout_alignParentRight="true">
</Button>
<LinearLayout
android:layout_alignParentTop="true"
android:layout_width="match_parent"
android:layout_height="match_parent">
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</android.inputmethodservice.KeyboardView>
and then tried loading it like:
kv = (KeyboardView)getLayoutInflater().inflate(R.layout.draw_signature, null);
// keyboard = new Keyboard(this, R.xml.drawing_keyboard);
// kv.setKeyboard(keyboard);
kv.setOnKeyboardActionListener(this);
kv.setPreviewEnabled(false);
return kv;
Any help or a tutorial link would be appreciated.
Thanks, Anand