Android:IME 建议栏中的按钮不可点击

发布于 2024-09-17 01:26:37 字数 476 浏览 1 评论 0原文

我将 InputMethodService 子类化以创建我自己的个人键盘。很多东西已经很好用了。但现在我正在使用建议栏(也称为“候选视图”)。现在我只是尝试加载一个带有一个按钮的静态布局:

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

 return mView;
}

结果如下所示:

alt text

这正是我所期望的,但有一个大问题:建议栏中的按钮根本无法选择或点击。

有什么想法吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

陌伤ぢ 2024-09-24 01:26:37

您是否实现了您认为的点击等接口?此外,View 类有一个静态方法来膨胀视图,因此您可以直接说,

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

而不是保留对膨胀器的引用。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文