Skip to content

Commit 400ef9b

Browse files
committed
Fix keyboard height issue
Temporarily forcing Rect().top to always be 0.
1 parent 83af823 commit 400ef9b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pythonforandroid/recipes/android/src/android/_android.pyx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,14 @@ if mActivity:
190190
@java_method('()V')
191191
def onGlobalLayout(self):
192192
rctx = Rect()
193+
# print('rctx_bottom: {0}, top: {1}'.format(rctx.bottom, rctx.top))
193194
mActivity.getWindow().getDecorView().getWindowVisibleDisplayFrame(rctx)
195+
# print('rctx_bottom: {0}, top: {1}'.format(rctx.bottom, rctx.top))
196+
# print('activity height: {0}'.format(mActivity.getWindowManager().getDefaultDisplay().getHeight()))
197+
# NOTE top should always be zero
198+
rctx.top = 0
194199
self.height = mActivity.getWindowManager().getDefaultDisplay().getHeight() - (rctx.bottom - rctx.top)
200+
# print('final height: {0}'.format(self.height))
195201

196202
ll = LayoutListener()
197203
python_act.mView.getViewTreeObserver().addOnGlobalLayoutListener(ll)

0 commit comments

Comments
 (0)