title: Adjust the layout when the Android soft keyboard is shown or hidden
body: <p>My goal is to achieve what most messaging apps like Facebook messenger, Viber, What's up do when displaying an attachment sheet. If the Soft keyboard is visible and the user wants to attach something, the keyboard is hidden and the attachment sheet is presented in its place. </p>
  
  <p>In order to make this work, the layout changes should happen when the root view size changes. Otherwise, a graphical <strong>glitch</strong> occurs where my layout changes are applied shortly before keyboard is shown/hidden.</p>
  
  <p>If I could change my layout the exact moment the keyboard is hidden, I could get it right. I have tried using <code>onGlobalLayoutListener</code> but without the desired outcome.</p>
  
  <p><a href="https://i.stack.imgur.com/K5ljy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/K5ljy.png" alt="enter image description here"></a></p>