try to call the initializeControls() at onStart(); because it's at that point when you have the interface created and then you put your typeface and text. I hope I helped you :)
Custom typeface lays on top of original text
Question
I use my own font from assets/fonts folder and sometimes when I start the app (not always), the original text and font is loaded and my own typeface is loaded on top of the original text. It's like my own font is applied to slow.
Is there something I can do to prevent this from happening. This is the code:
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
// some code
initializeControls();
}
private void initializeControls() {
// TextViews
Typeface tf = Typeface.createFromAsset(getActivity().getAssets(), "fonts/Roboto-Thin.ttf");
Typeface tfLight = Typeface.createFromAsset(getActivity().getAssets(), "fonts/Roboto-Light.ttf");
tvTimer = (TextView)getActivity().findViewById(R.id.textViewTimer);
tvTimer.setTypeface(tf);
}
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow