Android custom keyboard with 2 lablels (main and small at the top right)

試著忘記壹切 提交于 2019-12-04 16:46:32

you need to create a KeyboardView extends class and override OnDraw method like this:

public class MKeyboardView extends KeyboardView {
    @Override
    public void onDraw(Canvas canvas) {
        super.onDraw(canvas);

        Paint paint = new Paint();
        paint.setTextSize(15);
        paint.setColor(Color.GRAY);

        List<Key> keys = getKeyboard().getKeys();
        for(Key key: keys) {
        if(key.codes[0] == 113)
            canvas.drawText("1", key.x + (key.width/2), key.y + 25, paint);
        }
    }
}

you can change the position by changing the x and y parameters.

enjoy :)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!