I am building a quiz game in Kivy, that has a TextInput option for users at the bottom of the screen. It's at the bottom because the clues for the answers are displayed at the top.
The issue I am having is when I deploy my app to my phone, the Android on-screen keyboard pops up and blocks out nearly half my screen.
I tried the softinput_mode
in the Windows package, but this seems to push my entire screen up and so now, the top half of the screen is gone (and users can no longer see the clues).
Is there a way to incorporate this within the FloatLayout where my TextInput box is?
If it helps, here is a sample code that will help you recreate the issue and see what I mean:
main.py:
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.boxlayout import BoxLayout
from kivy.core.window import Window
Window.softinput_mode = "below_target"
class TestBox(BoxLayout):
pass
class RVTestApp(App):
def build(self):
return TestBox()
RVTestApp().run()
.kv file:
<GameWindow>:
FloatLayout:
Label:
pos_hint: {'center_x': 0.5, "center_y": 0.9}
size_hint: (0.2, 0.5)
font_size: 80
color: 0, 0, 0, 1
text: "TEXT AT TOP OF SCREEN"
TextInput:
pos_hint: {'x': 0.25, 'y': 0.05}
size_hint: (0.3, 0.05)
id: guess
multline:False
Button:
text: "CHECK BUTTON FOR ANSWERS AT BOTTOM OF SCREEN"
pos_hint: {"x": 0.6, "y": 0.05}
size_hint: (0.3, 0.05)
Would really appreciate any help on how to get this bit fixed, thank you!