Font does not apply to CheckBox and Switch Android Studio 3

After upgrading to Android Studio 3 and using the latest SDK and build tools, it is possible to add fonts to the folder fontsunder resources and use them directly in xml or java. I use this code in my theme in styles.xmlto apply the theme in my application

<item name="android:fontFamily">@font/iransansfont</item>

He is working on Button, TextViewand almost everything except CheckBoxand Switchwidgets. I even tried fontFamilyon mine CheckBoxand Switch, but it doesn't work either. How can i fix this?

+4
source share
1 answer

It is currently not possible to install fonts with font resources through XML. You can do this programmatically and not:

checkBox.setTypeface(ResourcesCompat.getFont(context, R.font.your_font));

Android-, : https://issuetracker.google.com/issues/63250768

+6

Source: https://habr.com/ru/post/1688551/


All Articles