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

zoha131

11/21/2020, 4:59 PM
How can I clear focus? I have tried
FocusRequester#freeFocus()
but it does not work for me.
l

Leland Richardson [G]

11/21/2020, 6:34 PM
This got me as well. Currently you do this by getting the AmbientFocusManager and calling clearFocus on it
Api is still in flux though iiuc
z

zoha131

11/21/2020, 6:55 PM
It works. Thanks a lot.
d

David Attias

11/23/2020, 11:14 AM
How do you get that
AmbientFocusManager
?
n

nickbutcher

11/23/2020, 4:07 PM
AmbientFocusManager.current
d

David Attias

11/23/2020, 4:16 PM
Can't find that class... is it rather FocusManager ?
n

nickbutcher

11/23/2020, 4:31 PM
Oh sorry, looks like it was renamed from
FocusManagerAmbient
in https://android-review.googlesource.com/c/platform/frameworks/support/+/1495457 which won't be released until
alpha08
i.e. try
FocusManagerAmbient.current
d

David Attias

11/24/2020, 9:18 PM
Thanks! It's working reat!
7 Views