Reputation: 3057
I have implemented my own class extending the android android.widget.Button
class to have a custom font used in all my buttons.
To achieve this I have overridden the method setTypeface
as following :
public void setTypeface(Typeface tf, int style) {
if (!isInEditMode()) {
super.setTypeface(Fonts.get(style, getContext()));
}
}
This works great in all versions of android that my app supports, except on lollipop. Does anyone know what I am doing wrong for that?
Upvotes: 1
Views: 217
Reputation: 3057
I figured it out, I forgot to override the other definition of the method setTypeface
. So the final working code I got is :
@Override
public void setTypeface(Typeface tf) {
if (!isInEditMode()) {
super.setTypeface(Fonts.get(getContext()));
}
}
@Override
public void setTypeface(Typeface tf, int style) {
if (!isInEditMode()) {
super.setTypeface(Fonts.get(style, getContext()));
}
}
Upvotes: 1