Layout_DSL
Layout_DSL copied to clipboard
很有想法~
很有想法~ 可以推官方实现静态代码的预览功能~ 这样就可以抛弃 xml 了
private val rootView by lazy {
ConstraintLayout {
layout_width = match_parent
layout_height = match_parent
ImageView {
layout_id = "ivBack"
layout_width = 40
layout_height = 40
margin_start = 20
margin_top = 20
src = R.drawable.ic_back_black
start_toStartOf = parent_id
top_toTopOf = parent_id
onClick = { onBackClick() }
}
TextView {
layout_width = wrap_content
layout_height = wrap_content
text = "commit"
textSize = 30f
textStyle = bold
align_vertical_to = "ivBack"
center_horizontal = true
}
}
}
静态代码预览功能是啥?