Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to align the text inside a text button at start(left end) of the screen?

I tried to align the text at start of screen inside the text button but for some reason I cannot do it. It aligns the text at center of Text Button no matter what.

TextButton(
        onClick = { /*TODO*/ },
        modifier = Modifier
            .fillMaxWidth()

    ) {
        Text(
            text = "Option A",
            style = MaterialTheme.typography.bodySmall,
            textAlign = TextAlign.Start,
            modifier = Modifier
        )

    }

Expected
Reality

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

The content of a (Text)Button is by default put into a Row with horizontalArrangement = Arrangement.Center. You can make your Text aligned to the start by making it fill the whole width of that Row, for example with Modifier.weight(1F).

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading