Reputation: 481
I'm developing an android keyboard that is based on soft keyboard. What I want is to change the keys label textstyle ex. (bold, shadowColor, innerShadow, color, etc...).
How to do that?
Upvotes: 1
Views: 2651
Reputation: 777
Change keys Label:
mQwertyKeyboard.getKeys().get(2).label="Label Name";
Change keys Font & Bold:
@Override
public void onDraw(Canvas canvas) {
super.onDraw(canvas);
Typeface tf = Typeface.createFromAsset(this.getAssets(),"avanish.ttf");
List<Keyboard.Key> keys = getKeyboard().getKeys();
for (Keyboard.Key key : keys) {
Paint paint = new Paint();
paint.setTypeface(tf);
paint.setTypeface(Typeface.DEFAULT_BOLD);
canvas.drawText(key.label.toString(), key.x + key.width,
key.y + key.height, paint);
}
}
and Other things like shadowColor, innerShadow etc change using res/values/styles in android. So learn more about the styles.
Thanks.
Upvotes: 1