question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[MaterialDatePicker] Set different text values for different calendars

See original GitHub issue

Is your feature request related to a problem? Please describe. It is only possible to override strings globally.

Describe the solution you’d like I want to be able to set different text values for different date pickers.

Describe alternatives you’ve considered I’ve overridden the strings globally, but I want to set different text values for different calendars. I have not been able to find a way to do this. Is it possible?

<string name="mtrl_picker_cancel" description="Placeholders for two dates separated by a dash representing a range [CHAR_LIMIT=60]" tools:override="true">Overridden value</string>

I have tried creating an attribute with the same name and overriding it in my theme, but it has no effect.

<attr name="mtrl_picker_cancel" />
<style name="MaterialComponentsThemeBlueAvailableDates" parent="MaterialComponentsTheme">
    <item name="materialCalendarTheme">@style/OurMaterialCalendar</item>
    <item name="mtrl_picker_cancel">Overridden value</item>
</style>

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
CasperHallerietcommented, May 20, 2020

I think thats currently not possible. I’m waiting at this issue https://github.com/material-components/material-components-android/issues/1268 . As soon as we are able to customize our selectors we can also customize titles, names and other things on the datepicker (for example disabling text input).

0reactions
4hmetCetcommented, Nov 7, 2022

Other tags for changing date range picker texts. <string tools:override="true" name="mtrl_picker_save">Kaydet</string> <string tools:override="true" name="mtrl_picker_range_header_title">Tarih Aralığı Seçiniz</string> <string tools:override="true" name="mtrl_picker_input_range_start">Başlangıç</string> <string tools:override="true" name="mtrl_picker_range_header_only_end_selected">Başlangıç – %1$s</string> <string tools:override="true" name="mtrl_picker_range_header_only_start_selected">%1$s – Bitiş</string> <string tools:override="true" name="mtrl_picker_range_header_selected">%1$s – %2$s</string> <string tools:override="true" name="mtrl_picker_range_header_unselected">Başlangıç – Bitiş</string> <string tools:override="true" name="mtrl_picker_text_input_date_hint">Tarih</string> <string tools:override="true" name="mtrl_picker_text_input_date_range_end_hint">Bitiş Tarihi</string> <string tools:override="true" name="mtrl_picker_text_input_date_range_start_hint">Başlangıç Tarihi</string> <string tools:override="true" name="mtrl_picker_text_input_day_abbr">g</string> <string tools:override="true" name="mtrl_picker_text_input_month_abbr">a</string> <string tools:override="true" name="mtrl_picker_text_input_year_abbr">y</string> <string tools:override="true" name="mtrl_picker_invalid_format">Hatalı format.</string> <string tools:override="true" name="mtrl_picker_invalid_format_example">Örnek: %1$s</string> <string tools:override="true" name="mtrl_picker_invalid_format_use">Format: %1$s</string> <string tools:override="true" name="mtrl_picker_invalid_range">Hatalı aralık.</string>

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to set texts on MaterialDatePicker? - Stack Overflow
You can use the builder.setSelection method: val builder = MaterialDatePicker.Builder.dateRangePicker() val selection = Pair(startDate ...
Read more >
Date pickers - Material Design
Calendar date pickers can be used to select dates in the near future or past, when it's useful to see them in a...
Read more >
MaterialDatePicker - Android Developers
Date picker will start with calendar view. int, INPUT_MODE_TEXT. Date picker will start with input text view.
Read more >
Date Picker - Android Studio Tutorial - YouTube
Hello World,Welcome to another MDC tutorial.This tutorial will cover implementing Date Pickers.
Read more >
More Functionalities of Material Design Date Picker in Android
set the validator point forward from june ... material date picker Calendar constraints ... now update selected date preview text.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found