Issue in the Assets folder
I had an issue where a font didnt work and it gave me a FC. So I put the font file into the sdcard, and used CreateFromFile in the typeface and the font worked!
Here is the code I used for the Assets folder: holder.tv_SuraName =(TextView)convertView.findViewById(R.id.Start_Name);
holder.tv_SuraName.setTypeface(Typeface.createFromAsset(mContext.getAssets(), "suralist_font.ttf"));
But I changed the code to this and it worked:
holder.tv_SuraName = (TextView)convertView.findViewById(R.id.Start_Name);
Typef开发者_开发知识库ace Font = Typeface.createFromFile(new File(Environment.getExternalStorageDirectory()+"/asd.ttf"));
Does this mean I have a problem in the Assets folder? How can I fix this? Thanks
see this
Typeface font0 = Typeface.createFromAsset(getAssets(),"fonts/AmericanDream.ttf");
tv1.setTypeface(font0);
here fonts (folder in assets) folder containing AmericanDream.ttf file inside. like:assets-->fonts-->AmericanDream.ttf i hope this will help u.
AssetManager assetManager1 = getApplicationContext().getAssets();
Typeface tf1 = Typeface.createFromAsset(assetManager1, "James_Fajardo.ttf");
and used in textview like
urTextView.setTypeface(tf1, Typeface.BOLD);
hope useful for u.
精彩评论