禁用横向软键盘输入的全屏编辑视图? [英] Disabling the fullscreen editing view for soft keyboard input in landscape?
问题描述
在使用软键盘的 Android 设备上,我想防止全屏键盘编辑视图(如下所示)在横向模式下出现(即我只想看到软键盘本身及其背后的视图).>
我认为这可以使用 InputMethodService
上的 setExtractViewShown(false)
方法来实现,但我无法访问它的默认实例并且不想实现自定义输入法.
编辑添加:输入的视图不是 TextView
(它是带有自定义 InputConnection 的
View
实现),所以 android:imeOptions="flagNoExtractUi"
在这里不起作用.
我终于回答了我自己的问题:
可以在连接输入连接时禁用提取 UI(即全屏编辑模式):
@Override公共输入连接 onCreateInputConnection(EditorInfo outAttrs) {outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_EXTRACT_UI;//等等.}
On Android devices that use soft keyboards, I want to prevent the fullscreen keyboard editing view (shown below) from appearing when in landscape mode (i.e. I want to see only the soft keyboard itself and my view behind it).
I assume this can be achieved using the setExtractViewShown(false)
method on InputMethodService
, but I am unable to access the default instance of this and do not want to implement a custom input method.
Edited to add: the view to which input is going is not a TextView
(it's a View
with a custom InputConnection
implementation), so android:imeOptions="flagNoExtractUi"
won't work here.
I finally answered my own question:
The extract UI (i.e. the fullscreen editing mode) can be disabled at the point at which the input connection is hooked up:
@Override
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_EXTRACT_UI;
// etc.
}
这篇关于禁用横向软键盘输入的全屏编辑视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!