1

I've been working on an android APP and everything was working great and AM PM text in TimePickerDialog was showing just fine (as AM PM obviously), until I changed the default font face using fontFamily in theme and now the AM PM text is broken.

Now it shows as "A" and "P" in some devices and as "A" and "PM" in others. I'm attaching few screenshots to clear things a bit.

You can see here, AM PM is shown as just A and P

Here it is shown as A and PM

Below is the code how I'm using TimePickerDialog. (this code contains Lambda function, don't get confuse because of that)

TimePickerDialog timePickerDialog = new TimePickerDialog(this,
            (view1, hourOfDay, minute) -> {
                // Code for processing the time picked
            }, mHour, mMinute, false);
    timePickerDialog.show();

Below is the code I'm using to change default font for the app.

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="android:actionMenuTextColor">@color/orange_500</item>
    <item name="android:fontFamily">@font/gotham_book</item>
</style>

Can someone please help me debug this issue somehow or point me in the right direction to define and use some other dedicated theme for TimePickerDialog so that it uses the default font only and not the one defined in the AppTheme.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Rathore
  • 256
  • 4
  • 9

0 Answers0