實例
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
_binding = FragmentBlank2Binding.inflate(inflater, container, false)
val view = binding.root
binding.apply {
composeView.apply {
setContent {
// You're in Compose world!
MaterialTheme {
PlantDetailDescription(viewModel)
}
}
// Dispose the Composition when the view's LifecycleOwner
// is destroyed
// 當視圖的 LifecycleOwner 被銷毀時處置 Composition
setViewCompositionStrategy(
ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed
)
}
}
return view
}
0 comments:
張貼留言