Closed anilgorthy closed 4 years ago
@anilgorthy, you can use custom style as workaround to disable calendar input mode toggle. This toggle uses style attribute materialCalendarHeaderToggleButton
, so:
<style name="Widget.AppTheme.MaterialDatePicker" parent="ThemeOverlay.MaterialComponents.MaterialCalendar">
<item name="materialCalendarHeaderToggleButton">@style/Widget.AppTheme.MaterialCalendar.HeaderToggleButton</item>
</style>
<style name="Widget.AppTheme.MaterialCalendar.HeaderToggleButton" parent="Widget.MaterialComponents.MaterialCalendar.HeaderToggleButton">
<item name="android:visibility">gone</item>
</style>
And after that apply theme with:
MaterialDatePicker.Builder.dateRangePicker()
.setTheme(R.style.Widget_AppTheme_MaterialDatePicker)
Duplicate #1380
When I switch to the manual entry of date using a keyboard, the error messages when entering an invalid date format are confusing to our users and it takes at least two attempts before they understand the preferred format
Either the field should auto-format with "/" after entering the digits or allow developers to provide a custom message.
I tried to find a way to disable (see the attached image) the manual entry so, that users cannot enter the date manually but the API doesn't provide any mechanism.