androidandroid-layoutandroid-jetpack-composelayout-inflaterkotlin-multiplatform

Can we use xml layout inflation in KMM (Kotlin Multiplatform Mobile)?


Are we allowed to use XML layout in KMM? Does using XML in KMM will affect its functionality? When I create a project for KMM, Android Studio automatically creates using Jetpack Compose. Does it mean that we can only or should use jetpack compose for KMM?

in places like setContentView(R.layout.activity_main)

LayoutInflater inflater = (LayoutInflater)getApplicationContext().getSystemService (Context.LAYOUT_INFLATER_SERVICE); inflater.inflate(R.layout.new_layout,null);

etc


Solution

  • Of course you can use XML, the kmm framework just shares common business logic code, not shared UI。

    Android platform you can still use xml, IOS platform you can choose swift or object c。