我想以编程方式更改自定义键盘的关键文字大小。我已经实现了onDraw
方法:
@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);
}
}
}
但是我必须标记任何键。
答案 0 :(得分:0)
更改xml布局文件
android:keyTextColor="Your Color Name"