Mohit Ajwani
Mohit Ajwani

Reputation: 1338

Create custom keyboard in android using different layout and keys not being rectangle, shape picked from the drawable image

I have tried to use the custom keyboard in android. I tried the following links Custom keyboard - Android

I have also tried to create a custom keyboard using Android Custom keyboard link.

All these have a custom keyboard, but it uses the default key pattern of android.

I would like to create a keypad without such look and feel.

I want to create a keyboard with a key having occupied two rows in a column whereas some can occupy a space of 4 keys(2x2).

Example : https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcRtHoD_LfzD4AepsAffO2WQbMYzWlQdymMWAXqz47s8EwvryYNW

Look at the enter key in this keyboard.

Also, I want to use drawable images that can be used as the key, which can have wierd design. I would want to create the image shape depending on the png image.

Upvotes: 1

Views: 1601

Answers (2)

Mohit Ajwani
Mohit Ajwani

Reputation: 1338

I used the ImageButton and specified a source file for the drawable image.

This helped me with the image on the button, but the button still occupied a rectangle section. To remove the alpha region, I seeked help of the android:background property of ImageButton in android layout file.

    android:background="@android:color/transparent"
    android:src="@drawable/your_image"

Now, if you want to disallow button taps on those regions, you can refer the following link. Hexagon button with hexagon touch area

Upvotes: 1

QArea
QArea

Reputation: 4981

You can try create custom layout and use it when you want to show soft keyboard. Here's a link explaining how you can detect show/hide keyboard action: https://stackoverflow.com/a/24388539/3864698

Upvotes: 0

Related Questions