Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 picker dialog in circular style, it has keyboard icon to change circular style to manual entry style. This feature is available from Android Oreo OS devices. How to show Time picker dialog with manual(keyboard) entry by default in supporting devices ?

Time picker dialog with manual(keyboard) entry

like image 895
Krishna Avatar asked Oct 24 '25 02:10

Krishna


1 Answers

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

like image 183
Cybr Anvl Avatar answered Oct 25 '25 15:10

Cybr Anvl