TextAlign.Justify only works on the emulator, not on a physical device

1 day ago 4
ARTICLE AD BOX

why are all the lines (not just the last line of the paragraph) aligned to the left on a real device, while on a virtual device they are aligned to the width of the screen except for the last one (as they should be), why are they not aligned to the width on a real device? What am I doing wrong?

enter image description here enter image description here

class MainActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) enableEdgeToEdge() setContent { MyApplicationTheme { Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding -> HomeText( modifier = Modifier.padding(innerPadding) ) } } } } } @Composable fun HomeText(modifier: Modifier = Modifier) { Text( text = stringResource(R.string.home_long_text), modifier = modifier .fillMaxSize() .verticalScroll(rememberScrollState()) .padding(20.dp) .fillMaxWidth(), style = TextStyle( textAlign = TextAlign.Justify, lineBreak = LineBreak.Paragraph, hyphens = Hyphens.Auto ) ) } @Preview(showBackground = true) @Composable fun HomeTextPreview() { MyApplicationTheme { HomeText() } }
Read Entire Article