Skip to content

Instantly share code, notes, and snippets.

@tatocaster
Created April 30, 2017 08:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tatocaster/ff4ac67dcaf9ccc82233d3b1569e52b1 to your computer and use it in GitHub Desktop.
Save tatocaster/ff4ac67dcaf9ccc82233d3b1569e52b1 to your computer and use it in GitHub Desktop.
ListItemSpec
@LayoutSpec
class ListItemSpec {
@OnCreateLayout
static ComponentLayout onCreateLayout(
ComponentContext c,
@Prop(optional = true, resType = ResType.DIMEN_OFFSET) int shadowRadius,
@Prop(optional = true) int color,
@Prop String title,
@Prop String subtitle) {
return Column.create(c)
.paddingDip(ALL, 16)
.backgroundColor(color)
.child(
Text.create(c)
.text(title)
.textSizeSp(40))
.child(
Text.create(c)
.text(subtitle)
.textStyle(ITALIC)
.textSizeSp(20))
.child(EditText.create(c)
.gravity(Gravity.CENTER)
.textSizeDip(14)
.build())
.build();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment