주의 : 아래와 같이 프래그먼트와 혼용시 setContent { } 를 호출하면 fragment binding이 다 무시되고 compose만 호출되는 문제가 생길수 있다


이를 해결하기 위해서는
binding된 xml에 아래를 선언하고 composeView를 아래와 같이 선언해야한다
<androidx.compose.ui.platform.ComposeView
    android:id="@+id/compose_view"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:layout_constraintTop_toTopOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintBottom_toBottomOf="parent"/>
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
//        DataBindingUtil.setContentView<MainBinding>(this, R.layout.main)
        val binding = MainBinding.inflate(layoutInflater)
        setContentView(binding.root)
binding.composeView.setContent {
   imgLoaderViewModel.imgRefresh()
   imgLoaderViewModel.loadImages()

'Android Dev > Compose' 카테고리의 다른 글
| Classes trial, variable initializing (0) | 2022.02.28 | 
|---|---|
| Coroutines 잊기 쉬운 개념 정리 (0) | 2022.02.04 | 
| compose에서 statusbar color(header 등) 변경 (0) | 2021.12.15 | 
| compose - TextField indicator(underline) customizing (0) | 2021.12.08 | 
| OutlinedTextField - trials (0) | 2021.12.07 | 
