[Android] android widgets stop rendering when the keyboard opens

I am adding Android ImageButton on top of SDL_Surface. In Activity onCreate():

val keyboardLayout = RelativeLayout(this)
val params = RelativeLayout.LayoutParams(
    RelativeLayout.LayoutParams.MATCH_PARENT,
    RelativeLayout.LayoutParams.MATCH_PARENT)
keyboardLayout.gravity = Gravity.BOTTOM or Gravity.LEFT

keyboardButton = ImageButton(this)
keyboardButton.layoutParams = RelativeLayout.LayoutParams(
    RelativeLayout.LayoutParams.WRAP_CONTENT,
    RelativeLayout.LayoutParams.WRAP_CONTENT)
keyboardButton.setImageResource(R.drawable.ic_keyboard_outline_bluegrey_24dp)
keyboardButton.setOnClickListener {
    onNativeKeyDown(KeyEvent.KEYCODE_F12)
}

keyboardLayout.addView(keyboardButton)
addContentView(keyboardLayout, params)

The button is drawn well only until SoftKeyboard appears. The button becomes invisible after opening the keyboard (it does not render for some reason), but you can still click on it. The button starts automatically rendering again after closing the keyboard.

I also tried displaying textview, the behavior remains the same.

I am using sdl 2.0.12. Please tell me what I can do so that the widgets do not stop redrawing?