Reputation: 9
I'm working on an android keyboard project. I wanna change font size of KeyLabel
in android custom keyboard.
for example I have something like this , And I'm going to change it to this
Upvotes: 0
Views: 263
Reputation: 9
After some days I found the way! I used canvas
in my CustomKeyboardView
class , so I just used a condition to draw it :\
public class CustomKeyboardView extends KeyboardView {
public CustomKeyboardView(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public void onDraw(Canvas canvas) {
super.onDraw(canvas);
Paint paint = new Paint();
canvas.drawPaint(paint);
paint.setColor(Color.WHITE);
paint.setTextSize(16);
boolean abc = false ;
List<Keyboard.Key> keys = getKeyboard().getKeys();
for (Keyboard.Key key : keys) {
if (key.codes[0] == -2)
{
canvas.drawText("My Text", key.x, key.y, paint);
}
}
}
}
Upvotes: 1