Toast throws ArrayIndexOutOfBoundsException with appcompat v26 when using fontFamily attribute in theme

前端 未结 2 1700
一生所求
一生所求 2021-01-06 13:35

Whenever I show a Toast, the app crashes.

The app works fine if I use older version of AppCompat library or remove fontFamily from the styl

2条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-06 13:57

    According to the Android Developer Guide for fonts in xml

    Adding fonts to style

    Open the styles.xml, and set the fontFamily attribute to the font file you want to access.

    
    

    In your case you should put the @font/ prefix

    @font/sans-serif-light
    

提交回复
热议问题