【发布时间】:2016-05-07 16:42:42
【问题描述】:
所以,我正在制作一款名为 Fall Down 4 的游戏,目前我只使用内置字体(它通常附带的字体)。现在,我希望标题看起来更有吸引力和更好,为此,我实际上从 Google 下载了不同的字体。然后我创建了一个资产文件夹,并在该文件夹中复制了我安装在计算机中的字体(我查看了有关堆栈溢出的不同论坛)。现在我的问题是如何将默认字体更改为这个新下载的字体。就像我只是不知道去哪里更改文本的字体。
我看到很多人在这四个问题上问这个问题,但我想要的是不同的字体,不是内置的字体,我想使用我下载的字体,这就是我需要帮助的。
所以请逐步告诉我如何将文本的字体更改为我在计算机中安装的字体。
代码:
公共类 FallDown4TitleScreen 扩展 AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_fall_down_title_screen);
Typeface myTypeFace = Typeface.createFromAsset(getAssets(), "Spac3 tech free promo.ttf");
final Button playbutton = (Button) findViewById(R.id.Playbutton);
final Button custButton = (Button) findViewById(R.id.custButton);
final Button settingButton = (Button) findViewById(R.id.settingButton);
final TextView textView = (TextView) findViewById(R.id.textView);
textView.setTypeface(myTypeFace);
playbutton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
custButton.setVisibility(View.INVISIBLE);
settingButton.setVisibility(View.INVISIBLE);
textView.setVisibility(View.VISIBLE);
playbutton.setVisibility(View.INVISIBLE);
}
});
}
}
【问题讨论】:
标签: android css google-chrome android-studio fonts