自定义软键盘按键预览 [英] customize soft keyboard key preview

查看:155
本文介绍了自定义软键盘按键预览的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正在使用软键盘.我已经完成了所有功能.

I am working on soft keyboard. I had done with all of my functionality.

但是现在我只需要更改键预览的视图(当键为 按下.当前显示我的按键预览(默认示例键盘按键 预览),如下图所示,

But now i just need to change view of key preview when key is pressed. Currently my key preview is shown(default sample keyboard key preview) like shown in below image,

我们可以看到,按下键时会弹出字符d.

As we can see character 'd' is popped up when key is pressed.

但是现在我需要对其进行自定义.由于当前关键预览背景是 白色,我需要它设置绿色,如下所示,

But now i need customize it. As currently key preview background is white, i need it to set green color just like shown below,

我有示例键盘代码,但找不到它的放置位置 显示弹出字母.因此,我可以轻松地按照自己的方式对其进行自定义.

I have the sample keyboard code, but couldn't find the place where it show a popout letter. So i can easily edit it customize it my own way.

我在Google上寻求帮助,但没有找到任何帮助.任何帮助是 赞赏.

I googled for help nothing found any help any. Any help is appreciated.

推荐答案

您可能已经创建了android.inputmethodservice.KeyboardView.xml布局资源文件

You may have created a android.inputmethodservice.KeyboardView.xml layout resource file

使用android:keyBackground="#FF419F3C"

<?xml version="1.0" encoding="utf-8"?>
<android.inputmethodservice.KeyboardView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent" android:layout_height="wrap_content"
    android:id="@+id/keyboard"
    android:labelTextSize="20dp"
    android:background="@color/colorTrybg"        
    android:keyTextColor="@color/colorTrykey"
              <!-- This one -->
    android:keyBackground="#FFFFFF"
    android:layout_alignParentBottom="true"
    android:keyPreviewLayout="@layout/preview">
</android.inputmethodservice.KeyboardView>

这篇关于自定义软键盘按键预览的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆