12

first screen second screen

Today i've updated my android sdk to 19 api, and while testing my app I have encountered some bugs in 19 api: drop some fonts in text view, or have problems with it's size.

first screen, code of one view:

tvBalance = new TextView(getContext());
    rlParams = new LayoutParams(frame.width, (int) (frame.heigth * zoneExtetn));
    rlParams.setMargins(frame.left, (int) (frame.top - frame.heigth * (zoneUp-0.1f)), 0, 0);
    tvBalance.setLayoutParams(rlParams);
    tvBalance.setGravity(Gravity.CENTER);
    tvBalance.setPadding(0, 0, 0, 0);
    tvBalance.setTextColor(0xffffd008);
    tvBalance.setTextSize(PokerTextSize.scaleFont(getContext(), 28));
    tvBalance.setText("$ 0 000 000 000");
    tvBalance.setTypeface(TypefaceBase.getCalibri((Activity) getContext()));
    rlMoney.addView(tvBalance);

and second screen code:

TextView tvText = new TextView(llContent.getContext());
            llParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
            llParams.setMargins(0, 0, 0, marg*2);
            tvText.setLayoutParams(llParams);
            tvText.setTextSize(fonts[0]);
            tvText.setTextColor(articleColor);
            tvText.setText(Html.fromHtml(articleItem.getString()));
            tvText.setTypeface(TypefaceBase.getCalibri((Activity) this.getContext()));

            llContent.addView(tvText);

Anybody have these problems in android 4.4 kit-kat?

Adnan Mulla
  • 2,872
  • 3
  • 25
  • 35
Anton
  • 251
  • 3
  • 13
  • still downloading...But I'm more interested in the google play services library update. – danny117 Nov 01 '13 at 15:02
  • I am having the exact same problem. My custom font is not rendering on KitKat. Since it was a glyph font I was trying to use, I am going to have to revert to imagesviews if I cannot find a solution – joseph Nov 14 '13 at 17:45
  • I am having same problem i used Custom font's and now it is not working for kitkat. – Sunil Parmar Nov 15 '13 at 12:24
  • 2
    Is the HTML using bold and/or italics, by chance? If so, it's most likely you're running into http://code.google.com/p/android/issues/detail?id=61771 which is a known issue. – Raph Levien Nov 23 '13 at 16:53
  • In first time i don't use HTML text, but have this problem. But in second you are right. – Anton Nov 25 '13 at 08:19
  • Looks like this is fixed in 4.4.1 –  Jan 02 '14 at 10:01

4 Answers4

5

I'm having a similar issue, and found this thread. See if that helps.

Custom ttf fonts are not showing properly in TextView on Android 4.4 KitKat

Edit:

I was having the same issue while using calibri.ttf. I switched over to lato.ttf (available on google.com/fonts), and they work fine/look extremely similar.

Community
  • 1
  • 1
Submersed
  • 8,810
  • 2
  • 30
  • 38
1

I had the same issue, i was using AppleLiGothic.ttf font for my app, it was like 5mb file size. Anyways later on i have changed the font to Roboto-Light.ttf . I took this font from the android19 sdk data folder. I think some fonts might not be compatible currently it is better to try few until you find which one works.

kmarin
  • 332
  • 3
  • 8
1

Font didn't work for me too on Android 4.4.2 (Kitkat) i resolved the problem by converting my file.ttf to file.otf

remplace :

Typeface typeface = Typeface.createFromAsset(activity.getAssets(), "yourFont.ttf");
yourTextView.setTypeface(typeface);

by :

Typeface typeface = Typeface.createFromAsset(activity.getAssets(), "yourFont.otf");
yourTextView.setTypeface(typeface);

FYI : the .otf format work for all android version (not only on kitkat)

Netero
  • 3,761
  • 2
  • 29
  • 29
0

What I have been doing is putting the font in the assets folder and loading it as such:

Typeface typeface = Typeface.createFromAsset(activity.getAssets(), "yourFont.ttf");
yourTextView.setTypeface(typeface);

I haven't had any problems in Kit Kat when I use this method

Gamplod
  • 43
  • 7