Jetpack撰写文字显示令人困惑

时间:2020-05-26 08:19:29

标签: android android-jetpack-compose

如果代码是这样的:

Text(
    "Text with background",
    Modifier.drawBackground(Color.Magenta, RectangleShape).padding(10.dp)
)

first drawBackground second do padding

Text(
    "Text with background",
    Modifier.padding(10.dp).drawBackground(Color.Magenta, RectangleShape)
)

first do padding second drawBackground

jetpack撰写配置

composeOptions {
    kotlinCompilerVersion "1.3.70-dev-withExperimentalGoogleExtensions-20200424"
    kotlinCompilerExtensionVersion = "0.1.0-dev10"
}

implementation 'androidx.ui:ui-framework:0.1.0-dev10'
implementation 'androidx.ui:ui-layout:0.1.0-dev10'
implementation 'androidx.ui:ui-material:0.1.0-dev10'
implementation 'androidx.ui:ui-tooling:0.1.0-dev10'

1 个答案:

答案 0 :(得分:4)

修饰符的顺序在Jetpack撰写中很重要 为了使其可见,我将其包裹在具有灰色背景的父母中:

unsubscribe()

enter image description here