作者:易中天我最爱 | 来源:互联网 | 2023-02-13 22:49
MygoalistoachievewhatmostmessagingappslikeFacebookmessenger,Viber,Whatsupdowhendis
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.
我的目标是实现大多数消息应用程序,如Facebook Messenger,Viber,显示附件表时的功能。如果软键盘可见并且用户想要附加某些东西,则隐藏键盘并将附件页显示在其位置。
In order to make this work, the layout changes should happen when the root view size changes. Otherwise, a graphical glitch occurs where my layout changes are applied shortly before keyboard is shown/hidden.
为了使其工作,布局更改应在根视图大小更改时发生。否则,在键盘显示/隐藏之前不久应用我的布局更改时会出现图形故障。
If I could change my layout the exact moment the keyboard is hidden, I could get it right. I have tried using onGlobalLayoutListener
but without the desired outcome.
如果我可以在键盘被隐藏的确切时刻改变我的布局,我可以把它弄好。我尝试过使用onGlobalLayoutListener但没有达到预期的效果。
3 个解决方案