Last active
February 9, 2022 09:24
-
-
Save parthdesai1208/427f5a0b72d23611bcb19a7e94dfa2a5 to your computer and use it in GitHub Desktop.
Jetpack Compose
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
@Preview | |
@Composable | |
fun ForSurface() { | |
Surface( | |
shape = MaterialTheme.shapes.medium, | |
elevation = 2.dp, | |
border = BorderStroke(1.dp, colorResource(id = R.color.black)), //apply border | |
color = colorResource(id = R.color.teal_200), //apply foreground color | |
contentColor = colorResource(id = R.color.white), //apply color to all child view | |
modifier = Modifier | |
.animateContentSize() // animateContentSize will change the Surface size gradually | |
.padding(1.dp) | |
) { | |
Text( | |
text = "Hi I am surface compose", | |
modifier = Modifier.padding(all = 4.dp), | |
// If the message is expanded, we display all its content | |
// otherwise we only display the first line | |
style = MaterialTheme.typography.body2 | |
) | |
} | |
} |
Author
parthdesai1208
commented
Feb 9, 2022
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment