Skip to content

Instantly share code, notes, and snippets.

@raulh82vlc
Last active March 29, 2021 19:42
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 raulh82vlc/a3e9cef7e5fcb04b837713f6f1772ef8 to your computer and use it in GitHub Desktop.
Save raulh82vlc/a3e9cef7e5fcb04b837713f6f1772ef8 to your computer and use it in GitHub Desktop.
SimpleTweetBox with compatible AndroidView
@Composable
fun SimpleTweetBox(
tweet: Tweet,
onClick: () -> Unit
) {
Box( // ...
) {
val user = tweet.user ?: ""
val imageUrl: String = tweet.images[0]
Column( // ...
) {
// ...
Spacer(modifier = Modifier.height(10.dp))
AndroidView(
modifier = Modifier.wrapContentHeight().wrapContentWidth(),
factory = { context ->
TextView(context).apply {
text = user
textAlignment = TEXT_ALIGNMENT_CENTER
maxLines = 1
setTextColor(android.graphics.Color.BLUE)
}
}
)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment