user9226293
user9226293

Reputation:

Change Key Icon from a Java File for a custom keyboard

I got a code to change key label from my java file by

keyboard.getKeys().get(0).label= "@";

I want to change my key icon as well. But it fails.

keyboard.getKeys().get(9).icon= R.Drawable.myicon;

an error shows when I do like that saying that is int value. I don't how to make this possible in other way.

Any Help?

Upvotes: 2

Views: 108

Answers (1)

Rajan Kali
Rajan Kali

Reputation: 12953

Yes, you need drawable for icon as in

keyboard.getKeys().get(9).icon = ContextCompat.getDrawable(Context, R.drawable.myicon);

Upvotes: 2

Related Questions