Kivy 软输入模式 below_target 不起作用

Kivy softinput mode below_target does not work

我正在为 Android 编写一个 Kivy 应用程序,最初当一个文本框被选中时,键盘会出现并盖住文本框。

所以我找到了这个参数:

Window.softinput_mode = "below_target"

When ‘below_target’, the window pans so that the current target TextInput widget requesting the keyboard is presented just above the soft Keyboard.

来自

Window - Kivy 1.9.1 Documentation

当我在我的 Windows 机器和 Android 设备上尝试 运行 时,我收到一条错误消息:

ValueError:  WindowSDL.softinput_mode is set to an invalid option 'below_target'

我错过了什么吗?

提前致谢, 库珀

below_target 选项比上一个稳定版本 Kivy 1.9 最近添加。如果你是 运行 这个版本,你还没有它。

您只需在 buildozer 要求行中将 kivy 更改为 kivy==master 即可在 android 上使用主分支。

在制作 MainApp(App) 之前使用此代码 并使用 kivy2.0.0

from kivy.core.window import Window
Window.keyboard_anim_args = {"d":.2,"t":"linear"}
Window.softinput_mode = "below_target"