Jetpack Compose DatePicker is taking empty space even if title and headline are empty

94 views Asked by At

Compose DatePicker is taking empty space even if the title and headline are empty.

It's already published as a bug: https://issuetracker.google.com/issues/267194809

DatePicker:

DatePicker(
    state = rememberDatePickerState(),
    modifier = Modifier.fillMaxWidth(),
    title = {
        // empty
    },
    headline = {
        // empty
    }
)

enter image description here

1

There are 1 answers

0
AI Shakil On BEST ANSWER

Hope this solution will remove the empty space.

  1. Just type 'null' in the title and headline;

  2. Then, you need to put 'false' in the showModeToggle parameter.

Here is the solution:

DatePicker(
    state = rememberDatePickerState(),
    modifier = Modifier.fillMaxWidth(),
    title = null,
    headline = null,
    showModeToggle = false
)