I cannot get a custom font to work in a Fragment in Android Studio version 1.5. Here is what I have so far in the java document.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
View view = inflater.inflate(R.layout.fragment_sponsors, container, false);
Typeface myTypeface = Typeface.createFromAsset(getActivity().getAssets(), "fonts/COOPPBL.TTF");
TextView tv = (TextView) view.findViewById(R.id.textview1);
tv.setTypeface(myTypeface);
return inflater.inflate(R.layout.fragment_sponsors, container, false);
}
And this is what I have in the pertinent XML code:
<TextView
android:id="@+id/textview1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/sponsors"
android:textSize="35sp"
/>
The font does not change and the output remains the default type. I have already created an assets folder in the main project folder, with a "fonts" sub-folder which contains the file "COOPBL.TTF". What am I missing? I feel like it is just a silly error; I am very new to the platform.