user3610010
user3610010

Reputation: 41

KeyboardView in Android

Whenever there is a long press in a key of a KeyboardView in Android, a small keyboard appears. It has the information set in android:popupCharacters and it has the look set in the xml that is set in the property android:popupKeyboard.

At some point, in my app the Label of the key changes (and therefore the popupCharacters related to the Key) but the Popup keeps being exactly the same as when it was created. In other words: if, when created, the PopupCharacters were XX, then for the Popup they will be always XX, no matter if the caracters changed into YY.

I have tried to change programmatically the PopupResId and the PopupCharacters with

mKeyboardView.Keyboard.Keys[i].PopupCharacters = AA;
mKeyboardView.Keyboard.Keys[i].PopupResId = Resource.Layout.BB;

But the modifications doesn't change anything. Any ideas about how to dynamically change that?

Thanks!

Upvotes: 2

Views: 457

Answers (1)

user3610010
user3610010

Reputation: 41

So, in case it is useful for anyone:

  • the function InvalidateKey(int i), apparently, does not invalidate the popup and therefore it stays the same, as the question states.
  • I solved this issue by creating a new Keyboard object and attaching it to the KeyboardView everytime I whant the popups to change. I am not sure if this is the best/most efficient way, but it works.

Upvotes: 2

Related Questions