Zach Klippenstein (he/him) [MOD]
05/18/2020, 3:53 PMOwnerAmbient
to get access to the root View for inflating nested Android views further down in the composition. The inflation is being done by another library, so I can't use the AndroidView(Int)
composable. However, OwnerAmbient
is deprecated. Is there (or will there be) another API for getting access to the View hosting a composition?Andrey Kulikov
05/18/2020, 4:50 PMAndroidView(View)
Zach Klippenstein (he/him) [MOD]
05/18/2020, 4:51 PMval context = ContextAmbient.current
val rootView = OwnerAmbient.current.view
val childView = remember { LayoutInflater.from(context).inflate(R.layout.foo, rootView, …) }
AndroidView(childView)
Except that inflation code is actually abstracted away by a different library, I just pass in the context and the parent view.Andrey Kulikov
05/18/2020, 5:57 PMZach Klippenstein (he/him) [MOD]
05/18/2020, 7:13 PM