Skip to content

Instantly share code, notes, and snippets.

@tshirtman
Created March 27, 2019 21:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tshirtman/47b7b18855b38de3730e081682c558ce to your computer and use it in GitHub Desktop.
Save tshirtman/47b7b18855b38de3730e081682c558ce to your computer and use it in GitHub Desktop.
from kivy.app import App
from kivy.lang import Builder
from jnius import autoclass
from android.runnable import run_on_ui_thread
KV = '''
FloatLayout:
TextInput:
size_hint: .5, None
height: min(self.minimum_height, 800)
pos_hint: {'center': (.5, .5)}
'''
class Application(App):
def build(self):
self._set_keyboard()
return Builder.load_string(KV)
@run_on_ui_thread
def _set_keyboard(self):
python_activity = autoclass('org.kivy.android.PythonActivity').mActivity
window = python_activity.getWindow()
window.setSoftInputMode(16) # SOFT_INPUT_ADJUST_RESIZE
if __name__ == '__main__':
Application().run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment