Reputation: 19956
I would like to use custom font in my application, so i just put that font file in asset folder. The file size is 4mb but the asset folder size is 2mb, so my font is not working..
This is my code
final TextView textView = (TextView) convertView;
textView.setCompoundDrawablesWithIntrinsicBounds(null,
new FastBitmapDrawable(info.getIcon(mIconCache)), null, null);
Typeface typeFace = Typeface.createFromAsset(context.getAssets(), "fonts/chen.ttf");
textView.setTypeface(typeFace);
textView.setText(info.title);
Any Help would be appreciated.
Upvotes: 1
Views: 460
Reputation: 50392
There has been a lot of talking about this limit, and it is supposed to have be removed by Android 2.3. Howevever, for preivous versions, a few tricks are available. The problem is file compression preformed by the system when your apk is built.
An easy but not so clean workaround is to change the file extension of your font file to one that is not compressed. For instance, call your file chen.mp3. This way, you are not limited.
Further reading and more details about this :
Dealing with asset compression
Using asset resource or raw ressource
Hope this helps.
Upvotes: 1