user568259
user568259

Reputation: 343

How to force redraw of soft keyboard

I created a custom keyboard which doesn't resize correctly when the orientation changes. I've tried invalidateKeys(), and manually setting the size of all of the keys, but no joy.

Upvotes: 1

Views: 3936

Answers (2)

jstock
jstock

Reputation: 116

I was having a simular problem with resizing my keyboardview's key height dynamically. To workaround the problem I did a couple of things:

1) Create a new class that extends the Keyboard class that defines a public getKeyHeight method and overrides the getHeight method. My prototype code:

public void setKeyHeight(int height) {
   super.setKeyHeight(height);
}

@Override
public int getHeight() {
   return getKeyHeight() * 3;
}

2) Defined a new method in my

double height_modifier = 1.5;

int height = 0;
for(Keyboard.Key key : mKeyboard.getKeys()) {
   key.height *= height_modifier;
   key.y *= height_modifier;
   height = key.height;
}
mKeyboard.setKeyHeight(height);

I hope this helps...

Upvotes: 1

warci
warci

Reputation: 123

My keyboard changes some keys and redraws the softkeyboard after the user hits any character button. I call the invalidateAllKeys() on my Subclass of KeyboardView to redraw the keyboard. invalidateAllKeys() works fine!

Upvotes: 0

Related Questions