Richard Graham
07/26/2021, 6:29 AMfun bind() {
binding.root.apply {
findViewById<ComposeView>(R.id.filter_button).setContent {
Random.Theme {
FilterButton()
}
}
}
}
Adding anything like padding or margin to the filterButton defined in XML will cause the element to re-render each time it is updated. E.g
This works:
<androidx.compose.ui.platform.ComposeView
android:id="@+id/filter_button"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
This doesn't:
<androidx.compose.ui.platform.ComposeView
android:id="@+id/filter_button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:paddingTop="@dimen/find_match_transactions_header_top_padding"
android:paddingEnd="@dimen/material_cell_side_padding"
android:paddingBottom="@dimen/find_match_transactions_header_bottom_padding"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>