views:

26

answers:

1

I'm subclassing InputMethodService to create my own personal keyboard. A lot of stuff already works quite nice. But now I'm playing around with the suggestion bar (also called "candiate view"). For now I'm just trying to load a static layout with one button in it:

@Override public View onCreateCandidatesView() {
 LayoutInflater mLayoutInflater = LayoutInflater.from(this);
 mView = mLayoutInflater.inflate(R.layout.suggestion_bar, null);

 return mView;
}

The result looks like this:

alt text

Which is exactly what I expected, but with one big issue: the button in the suggestion bar is not selectable or clickable at all.

Any thoughts?

+1  A: 

Did you implement the interfaces for clicking, etc in your view? Also the View class has a static method to inflate views so you can just say

View.inflate(R.layout.suggestion_bar, null);

instead of keeping a reference to the inflater.

schwiz
Thanks for the hint with the static inflate method.Regarding the interfaces for clicking, do you mean `onClickListeners`? No I didn't. But usually I don't need them. The buttons should still be clickable or selectable, even if nothing happens when I click it. Or do you mean something different I'm not aware of?
znq
Don't know what the problem was, but it seems to work now.
znq
I wasn't assuming you used a button class but were implementing your own view. Glad you got it up and running!
schwiz