简体   繁体   中英

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.

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM