Jetpack Compose Weight

December 15, 2021

Each OutlinedTextField occupy half the screen’s width.

Row() {
    OutlinedTextField(
        modifier = modifier.weight(1f).clickable {

        },
        value = formatDate(date) ?: "",
        onValueChange = {  },
        label = { Text("Date") },
        singleLine = true,
        readOnly = true
    )

    Spacer(modifier = Modifier.padding(4.dp))

    OutlinedTextField(
        modifier = modifier.weight(1f),
        value = formatTime(date) ?: "",
        onValueChange = {  },
        label = { Text("Time") },
        singleLine = true
    )
}
This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.