How can I detect if software keyboard is visible i...
# compose
z
How can I detect if software keyboard is visible in the screen or not?
a
I believe there is a
Copy code
TextField(
    ...
    onTextInputStarted: (SoftwareKeyboardController) -> Unit = {},
    ...
)
which you could use.
s
Android developers have been trying to solve this problem for 10 years 😁
😄 3
a
there is also the
TextInputServiceAmbient
which I believe you could use. If I am correct. (Maybe not 🤔 )
💯 1
z
Thank you folks. I need to learn Ambient. Currently I don’t know how Ambient works.
a
You could look at Ambient Docs here: https://developer.android.com/reference/kotlin/androidx/compose/runtime/Ambient Though I'm thinking about your problem. If you want to listen everytime, the soft keyboard show up.
TextInputService
might not solve it. As
TextInputService
only have method to control the text Input. hmmm... I hope someone from the Compose team notices your question. 🤔
z
I want to change my layout whenever there is a Soft Keyboard visible in the screen.
adjustPan
does not work as expected. so I am thinking manually changing the layout. I have seen an example in the Jetsurvey app. But I have multiple
TextInput
in my screen.