Mantas Varnagiris
06/17/2020, 8:29 AMAndroidView()
composable. I'm curious if there will be a way to show `Fragment`s in composables? Maybe it's already possible (I haven't tried yet). Maybe we can wrap fragment within a FrameLayout
or something?
The reason why I'm asking is that we're thinking of moving our app navigation to be within composables. All our screens are Fragment
s at the moment and ideally we would like to avoid converting each fragment to a custom view (before we can convert each of them to be composables)yennsarah
06/17/2020, 8:37 AMoverride fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
val fragmentView = inflater.inflate(R.layout.fragment_home, container, false)
(fragmentView as FrameLayout).setContent(Recomposer.current()) {
// Compose code
}
return fragmentView
}
This works for me - fragment xml is just a framelayout 🙂Mantas Varnagiris
06/17/2020, 8:40 AMyennsarah
06/17/2020, 8:43 AMMantas Varnagiris
06/17/2020, 8:44 AMandylamax
06/17/2020, 8:53 AM