Skip to content Skip to sidebar Skip to footer

How To Show Time Picker Dialog With Manual (keyboard) Entry By Default?

Time picker dialog shows circular timings by default to select date and time. Instead of it Need to show keyboard entry by default to select date and time. While showing time picke

Solution 1:

The time picker can be started in text input mode with:

MaterialTimePicker.Builder().setInputMode(INPUT_MODE_KEYBOARD)

For example:

val picker =
    MaterialTimePicker.Builder()
        .setTitleText(R.string.Set_time)
        .setTimeFormat(TimeFormat.CLOCK_12H)
        .setHour(12)
        .setMinute(30)
        .setInputMode(MaterialTimePicker.INPUT_MODE_KEYBOARD)
        .build()

picker.show(supportFragmentManager, "TimePicker")

Source: https://material.io/components/time-pickers/android#using-time-pickers

Solution 2:

In your showTimePicker() function you can set the initialEntryMode. By default it's TimePickerEntryMode.dial but you can change it to TimePickerEntryMode.input.

Just add: initialEntryMode: TimePickerEntryMode.input,

Post a Comment for "How To Show Time Picker Dialog With Manual (keyboard) Entry By Default?"