Reputation: 151
I am working on an application in which i need to create rows and keys of custom keyboard pro-grammatically in java code , instead of using XML. Is this possible ? If yes, how we can do that.
Currently ,I am using XML and creating row in this way:-
<Keyboard android:keyWidth="10.0%p"
android:keyHeight="@dimen/key_height" android:horizontalGap="0.0px"android:verticalGap="0.0px"
xmlns:android="http://schemas.android.com/apk/res/android">
<Row android:rowEdgeFlags="top" >
<Key android:codes="-21" android:keyIcon="@drawable/arbiclinenew" />
<Key android:codes="-51" android:keyIcon="@drawable/recentlinenew" />
</Row>
Basically , I need to show "recent"
view in my keyboard which show all recently selected emoji by user same as in whatsapp.
Please help..!!!!
Upvotes: 1
Views: 786
Reputation: 151
Finally ,I am able to create my own custom keyboard. We can create custom keyboard layout to show recent button. For example :
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<android.inputmethodservice.KeyboardView
android:id="@+id/keyboard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:textDirection="rtl"
android:keyPreviewLayout ="@layout/preview"></android.inputmethodservice.KeyboardView>
<android.support.v4.view.ViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</FrameLayout>
Now, suppose on any key click, you need to show emoji or any other view, then we can set keyboard visibility : invisible and can show your own layout.
Upvotes: 1