2

我希望将此字体导入 Android。我正在尝试使我的应用程序国际化,并且这种字体具有我需要的一些字符。

这是我用来创建按钮的一些代码,包括 xml 和应用程序。

<Button
            android:id="@+id/btn_example
            android:layout_width="44dp"
            android:layout_height="44dp"
            android:layout_alignParentLeft="true"
            android:layout_centerVertical="true"
            android:text="@string/example"
            android:background="@android:color/transparent"
            android:textSize="38sp"
            android:padding="0dp"
            android:textColor="@android:color/white"/>


@Override
protected void onCreate(Bundle savedInstanceState){

........
Typeface tf= Typeface.createFromAsset(getAssets(), fonts/OpenSans.ttf);
Button button = (Button)findViewById(R.id.btn_example);
button.setTypeface(tf);
.......

}

但是,似乎 Android 将字体呈现为低于字体应该放置的位置。

如果我拿了一张幼儿园的横格纸,并且必须写下 Android 设备如何呈现字体,我会说它写的字符中间低于那张纸的最低线。

我的问题是为什么以及如何解决这个问题?

4

0 回答 0