Last active
March 29, 2021 19:42
-
-
Save raulh82vlc/a3e9cef7e5fcb04b837713f6f1772ef8 to your computer and use it in GitHub Desktop.
SimpleTweetBox with compatible AndroidView
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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