I am trying to change the font style in my Android App. So I copy and paste the font file (.ttf) into the assets folder. After pasting it show's File was loaded in the wrong encoding :UTF-8 . How can I solve it? (attached picture below)
Note : I already tried following ways.
a) convert file encoding to UTF-8
b) set the right file encoding in your build.gradle script.
But the problem is not solved yet. It still shows encode formats error.
I faced similar issue when I was playing with fonts. I think you are facing the same issue. In my Android Studio .tff file was linked to a text file. I changed that in the File Type option in Settings and font was working fine.
Steps:
Hope this solves your issue.
Thankyou @Sreeram TP. This post may help to resolve that problem completely. I show my solution below.
After deactivating linking as text (pic1 below)
I deleted and re-pasted my font.ttf
file. It then shows the following alert (pic2 below):
I selected Open matching file in associated application .
This solved my problem completely.
It is not a problem actually. You can still use the custom font like this :
TextView text = (TextView) findViewById(R.id.custom_text); Typeface font = Typeface.createFromAsset(getAssets(), "yourfont.ttf"); text.setTypeface(font);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.