Home > database >  how to rotate and place text so that some is rotated and some is not in jetpack compose
how to rotate and place text so that some is rotated and some is not in jetpack compose

Time:04-21

my current image

I have this image already.

What I am trying for is more like

enter image description here

I am new to compose, I am not quite clear on how to do this, so this my fun; thanks!

 @Composable
 fun MyDate() {

 var calendar = Calendar.getInstance()
 var month = calendar.getDisplayName(Calendar.MONTH, 
 Calendar.SHORT, Locale.getDefault())
var day = calendar.get(Calendar.DAY_OF_MONTH).toString()

Column(
    horizontalAlignment = Alignment.CenterHorizontally
) {

        Text(
            modifier = Modifier.rotate(90f),
            fontWeight = FontWeight.Bold,
            text = month
        )

    Text(text = day)
     }
 }

CodePudding user response:

wrap them in a row

    Row() {
    Text(
        modifier = Modifier.rotate(90f),
        fontWeight = FontWeight.Bold,
        text = month
    )

    Text(text = day)
}
  • Related