I want to change key text size of my custom keyboard programmatically. I have implemented onDraw
method:
@Override
public void onDraw(Canvas canvas) {
super.onDraw(canvas);
Paint paint = new Paint();
paint.setTextAlign(Paint.Align.CENTER);
paint.setTextSize(25);
paint.setColor(Color.WHITE);
List<android.inputmethodservice.Keyboard.Key> keys = getKeyboard().getKeys();
for(android.inputmethodservice.Keyboard.Key key: keys) {
if(key.label != null){
String keyLabel = key.label.toString();
canvas.drawText(keyLabel, key.x + (key.width/2), key.y + 25, paint);
}
}
}
But I have to label for any key.