voi*_*dRy 6 android android-softkeyboard
我正在使用自定义键盘.我在onCreateCandidatesView()中设置了setCandidatesViewShown(true)函数,问题是UI没有得到正确的重新调整.
任何帮助都会很棒.以下就是我所做的
@Override
public View onCreateCandidatesView() {
LayoutInflater li = (LayoutInflater) getApplicationContext()
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View wordBar = li.inflate(R.layout.wordbar, null);
LinearLayout ll = (LinearLayout) wordBar.findViewById(R.id.words);
Button voiceCmd = (Button) wordBar.findViewById(R.id.voiceword);
LinearLayout ll1 = null;
Button voiceCmd1 = null;
//comment this block in the event of showing only one keyboard so that we can only
//one autocorrect bar
if (isLargeScreen) {
ll1 = (LinearLayout) wordBar.findViewById(R.id.words1);
voiceCmd1 = (Button) wordBar.findViewById(R.id.voiceword1);
}
voiceCmd.setOnClickListener(voiceClickListener);
mCandidateView = new CandidateView(this);
mCandidateView.setService(this);
setCandidatesViewShown(true);
mCandidateView.setLayoutParams(new LayoutParams(
LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
ll.addView(mCandidateView);
return wordBar;
}
Run Code Online (Sandbox Code Playgroud)
til*_*ish 10
我有同样的问题.我在这里找到了Ced的帖子.
解决方案是将此添加到您的输入法服务,
@Override public void onComputeInsets(InputMethodService.Insets outInsets) {
super.onComputeInsets(outInsets);
if (!isFullscreenMode()) {
outInsets.contentTopInsets = outInsets.visibleTopInsets;
}
}
Run Code Online (Sandbox Code Playgroud)
候选视图无意向上推送应用程序是故意的.来自doc,
请注意,因为候选视图往往会被显示和隐藏很多,所以它不会像软输入视图那样影响应用程序UI:它永远不会导致应用程序窗口调整大小,只会导致它们在需要时进行平移用户查看当前焦点.
上面的hack增加了"内容"区域以包括候选视图区域.doc for onComputeInsets将帮助您理解这个概念.
在UI中计算有趣的插图.默认实现使用候选框架的顶部用于可见插入,以及内容插入的输入框架的顶部.
| 归档时间: |
|
| 查看次数: |
2054 次 |
| 最近记录: |