我正在尝试在我的文本中添加自定义字体,但问题是文本上出现垂直条纹。它们不在字体中,而且问题似乎只出现在某些 Android 设备上。
这是我的文本视图
<TextView
android:id="@+id/header"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:layout_marginTop="4dip"
android:layout_marginBottom="4dip"
android:textColor="#00fff0"
android:textSize="14sp"
android:text="Header"/>
我在 onCreate() 函数中设置字体如下
((TextView) findViewById(R.id.header)).setTypeface(Typeface.createFromAsset(this.getAssets(), "bitbold2.ttf"));
当像这样初始化时在画布上绘制文本时也会出现同样的问题:
Typeface bitNanoFont = Typeface.createFromAsset(asset, "bitbold2.ttf");
Paint textPaint = new Paint();
textPaint.setARGB(255, 0, 255, 240);
textPaint.setTextSize(24);
textPaint.setTypeface(bitNanoFont);
并画成这样:
canvas.drawText("Text", 320, 50, textPaint);
生成的文本如下所示(TextView):
图像已放大,背景是彩色的,因为该图像是直接从应用程序中获取的。