https://kotlinlang.org logo
#compose
Title
# compose
z

zoha131

10/04/2020, 4:28 PM
How can I detect if software keyboard is visible in the screen or not?
a

Archie

10/04/2020, 4:37 PM
I believe there is a
Copy code
TextField(
    ...
    onTextInputStarted: (SoftwareKeyboardController) -> Unit = {},
    ...
)
which you could use.
s

Sergey Y.

10/04/2020, 4:38 PM
Android developers have been trying to solve this problem for 10 years 😁
😄 3
a

Archie

10/04/2020, 4:42 PM
there is also the
TextInputServiceAmbient
which I believe you could use. If I am correct. (Maybe not 🤔 )
💯 1
z

zoha131

10/04/2020, 4:45 PM
Thank you folks. I need to learn Ambient. Currently I don’t know how Ambient works.
a

Archie

10/04/2020, 4:49 PM
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

zoha131

10/04/2020, 4:52 PM
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.
8 Views