Kai Zhu
01/14/2021, 11:45 AMNote: Modifiers can play a similar role to XML attributes in the View system, but the type safety of scope-specific modifiers helps you to discover and understand what is available and applicable to a certain layout. Compare this with XML layouts where it was not always clear if a layout attribute was applicable to a given View.This is copied from the Jetpack Compose Codelab "Layouts in Jetpack Compose". But it's not true as far as I know, because xml layouts does have the ability to tell if a layout attribute is applicable to a given View. Am I wrong or have I misunderstood what the doc says? Source: https://developer.android.com/codelabs/jetpack-compose-layouts?continue=https%3A%2F%2Fd[…]developer.android.com%2Fcodelabs%2Fjetpack-compose-layouts
Icyrockton
01/14/2021, 12:14 PMAdam Powell
01/14/2021, 3:37 PMLayoutParams
attribute like android:layout_weight
in a place where the parent view will consume it. (e.g. in a child element of a <LinearLayout>
tag.) What we have is a series of hardcoded android lint checks for a known set of attrs and parent views instead, which, while useful, is not as robust and requires running that separate tooling pipeline to verify.Kai Zhu
01/14/2021, 11:34 PMAdam Powell
01/15/2021, 12:33 AM@LayoutScopeMarker
DSL marker annotation, it will leak available layout scope modifiers from the surrounding calling scope.Kai Zhu
01/15/2021, 1:28 AM@DslMarker
(for the first time), and I think this kind of "Not quite fully" design is reasonable, at a relatively-perfect balance point. And, I have to say Kotlin is really cool.