Search code examples
androidlayoutimeandroid-input-method

Android: button in IME's suggestion bar not clickable


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?


Solution

  • 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.