# ComposeView You can use ComposeView to use Compose inside a ViewGroup. This example will show you, how you can use ComposeView inside a FrameLayout. It should also work in other layouts like LinearLayout ## Create a custom FrameLayout Create a custom FrameLayout, then you can use the **ComposeView** and **setContent()** for example inside **init()**. Inside **setContent()** you can then add your Compose code. ```kotlin class ComposeFrameLayout @JvmOverloads constructor( context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 ) : FrameLayout(context, attrs, defStyleAttr) { init { addView( ComposeView(context).apply { setContent { Button(onClick = {}) { Text("ComposeButton") } } } ) } } ``` ## Add it to your layout file Just add your FrameLayout like any other layout. ```xml